Is there a way to fix PNG image display problems on IE6?

  • Suggestion
  • Thread starter zzzhhh
  • Start date
In summary, the conversation is regarding the issue of Internet Explorer 6 not being able to correctly display PNG images with transparent backgrounds. The suggestion is to either restore the PNG format back to its original version or add specific code in the <head> section for IE detection. However, it is mentioned that this is a known issue for IE6 and it is not likely to be updated due to the presence of newer browsers without this problem.
  • #1
zzzhhh
40
1
I'm still using IE6, which can not display PNG images with transparent background correctly. But the orignal PNG images can be shown correctly, such as those in https://www.physicsforums.com/showthread.php?t=8997. So, I wonder if the forum can restore the PNG format back to the orignal one, or, add the following codes into the <head>...</head> if IE is detected:

<script language="javascript">
function correctPNG()
{
for(var i=0; i<document.images.length; i++)
{
var img = document.images
var imgName = img.src.toUpperCase()
if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
{
var imgID = (img.id) ? "id='" + img.id + "' " : ""
var imgClass = (img.className) ? "class='" + img.className + "' " : ""
var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
var imgStyle = "display:inline-block;" + img.style.cssText
if (img.align == "left") imgStyle = "float:left;" + imgStyle
if (img.align == "right") imgStyle = "float:right;" + imgStyle
if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
var strNewHTML = "<span " + imgID + imgClass + imgTitle
+ " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
+ "(src=\'" + img.src + "\', sizingMethod='image');\"></span>"
img.outerHTML = strNewHTML
i = i-1
}
}
}
window.attachEvent("onload", correctPNG);
</script>


Thanks!
 
Physics news on Phys.org
  • #2
This is a known problem for IE6. I don't think it will be updated since there are newer browsers which are out there without the problem. Unfortunately, once newer browsers are released older ones tend to get left.
 
  • #3
Kurdt said:
This is a known problem for IE6.

Correctly put: IE is a known problem :wink:
 

1. Why is my PNG image not displaying correctly on my website?

There could be several reasons for this. It could be due to a corrupted file, incorrect file path, or compatibility issues with the browser or device being used to view the image. It could also be caused by incorrect coding or a missing image tag in your HTML.

2. How do I fix the PNG image display problem on my website?

First, check if the image file is valid and not corrupted. Then, make sure the file path in your HTML code is correct. You can also try clearing your browser's cache or using a different browser to see if that resolves the issue. Double-check your coding to ensure that all necessary image tags are included and properly formatted.

3. My PNG image is displaying as a broken image icon. What does this mean?

This typically means that the image file cannot be found in the specified file path. Check your HTML code to make sure the file path is accurate and that the image file is present in that location.

4. Why does my PNG image appear blurry or pixelated on my website?

This could be due to the image being resized or scaled up, which can result in loss of image quality. To avoid this, make sure to use the original, high-resolution version of the image and properly resize it using image editing software before uploading it to your website.

5. Can I use transparent PNG images on my website?

Yes, PNG images support transparency, which allows them to blend seamlessly with the background of your website. However, older browsers may not support transparent PNG images, so it's important to test your website on different browsers to ensure compatibility.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
8
Views
2K
Back
Top