always wondered why internet explorer does this...
Moderator: General Moderators
always wondered why internet explorer does this...
I've always noticed that internet explorer does not match the exact color in images on webpages (unless the color is black or white [maybe a few others, i haven't noticed yet]), which makes image links look really bad. Firefox has no problem with this, but IE sure does! Anyone know why it does this? Are there any work arounds for this problem? If you don't know what I'm talking about, go to http://paqmanweb.com/ssl/ and look at the header image. Thanks
Re: always wondered why internet explorer does this...
The issue you describe (cant check to be sure since you switched to a jpg) is most likely the infamous IE png bug. It renders the transparency incorrectly.paqman wrote:I've always noticed that internet explorer does not match the exact color in images on webpages (unless the color is black or white [maybe a few others, i haven't noticed yet]), which makes image links look really bad. Firefox has no problem with this, but IE sure does! Anyone know why it does this? Are there any work arounds for this problem? If you don't know what I'm talking about, go to http://paqmanweb.com/ssl/ and look at the header image. Thanks
There are at least three major workarounds, one js, one activex, and one in the way you save the png (black matte and 8-bit instead of 24-bit with no specified matte).
IE7 fixes the png bug.
-
RobertPaul
- Forum Contributor
- Posts: 122
- Joined: Sun Sep 18, 2005 8:54 pm
- Location: OCNY
It may be a transparency issue, but it sounds like a gamma "correction" issue to me...
Which is unique to IERobertPaul wrote:It may be a transparency issue, but it sounds like a gamma "correction" issue to me...
-
darryladie
- Forum Commoner
- Posts: 62
- Joined: Thu Mar 02, 2006 6:14 pm
- Location: East Sussex, UK
Javascript PNG Fix for IE
Javascript Fix for PNG Transparency in IE:
Darryl
Code: Select all
function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.
{
var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])
if ((version >= 5.5) && (document.body.filters))
{
for(var i=0; i<document.images.length; i++)
{
var img = document.images[i]
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='scale');\"></span>"
img.outerHTML = strNewHTML
i = i-1
}
}
}
}
window.attachEvent("onload", correctPNG);