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

  • Thread starter Thread starter zzzhhh
  • Start date Start date
AI Thread Summary
PNG images with transparent backgrounds do not display correctly in Internet Explorer 6 (IE6), although original PNG images are visible. Users suggest restoring PNGs to their original format or implementing a JavaScript solution to correct the display issue. The discussion acknowledges that IE6 is outdated and unlikely to receive updates, as newer browsers have resolved these problems. The consensus is that IE6's limitations are a recognized issue, and users may need to consider upgrading their browsers for better compatibility. Overall, the discussion highlights the challenges of using outdated technology in a rapidly evolving digital landscape.
zzzhhh
Messages
39
Reaction score
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
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.
 
Kurdt said:
This is a known problem for IE6.

Correctly put: IE is a known problem :wink:
 

Similar threads

Back
Top