Images don't show up in IE8

2019-08-18 18:45发布

问题:

As part of my job post announcements to a proprietary, password-protected site. There is no HTML control in the announcement panel nor is there a button that allows you to insert an image. I've worked around these limitations by making my own basic HTML pages with tables with images using the "img" tag. I open the HTML page in Firefox, then copy the web page into the announcement panel. I'm on a mac, so it's been working great in Firefox and I have IE6 in Parallels, and there is no problem there.

However, it's come to my attention (a little late, I suppose!) that none of the images show up in IE8 on the company's site (they appear when uploaded to my own site). I think it is because the images are not relative, but link to an offsite webpage, but I really do not know. I don't see how I can use relative links, as I don't have control over uploading images directly to the site. I noticed that changing the tag to "object" makes them display in IE8, but no show in IE6. I've tried nesting both "img" and "embed" tags into my tag and that doesn't work either on IE6.

When I looked at view source for the announcement on the site, the code hasn't changed at all from my original web page, so I'm assuming it must be something on the server end (which I have no control over).

Ideally, I want my images to show up in as many browsers as possible. Has anyone encountered this issue and solved it? Is there any code I can use that will display images for IE 6, 7, 8?

Thanks for reading my post, and Happy New Year!

回答1:

Have you tried not including a closing tag for <img>? According the spec, it's not supposed to have one. For example, you have:

<img src="http://www.freewebs.com/dird/adorable-puppies.jpg"></img>

Try making it look like this:

<img src="http://www.freewebs.com/dird/adorable-puppies.jpg">

Or if you are using XHTML:

<img src="http://www.freewebs.com/dird/adorable-puppies.jpg"/>


回答2:

Try running your site through an xhtml compliance tool to see if it comes back with any obvious markup issues.

W3C XHTML Validator

Also, check your XHTML doctype is appropriate for your markup.



回答3:

Make sure your image tag is a full path. http://example.com/myimage.jpb, then the other time I've seen this is due to the image being saved incorrectly. If it is saved as a CMYK, some browsers can't open those images. Try opening the source image in Paint, or some other image application and saving as an RGB image.