Welcome Guest!

If you do not have an account yet on The Web Squeeze forums, please Register! It’s FREE and there are many benefits:

  • Receive Fast Advice
  • Learn Programming Languages
  • Get Professional Website Reviews
  • Quick Troubleshooting Assistance

> Transparent Pngs In Ie6 & Browser Detection

This is a discussion on Transparent Pngs In Ie6 & Browser Detection, within the Web Development in General section. This forum and the thread "Transparent Pngs In Ie6 & Browser Detection" are both part of the Programming Your Website category.

 
Reply to this topicStart new topic
> Transparent Pngs In Ie6 & Browser Detection
djeyewater
post May 21 2008, 07:04 AM
Post #1


Squeezing
***

Posts: 81
Joined: 18-February 08


I need a way to get IE6 to render pngs with transparency properly. Javascript solutions I've used aren't much good as they wait for the image (or page) to fully load before applying the fix.

I could use php to detect whether the browser is IE6 and then serve up a fixed page, but I am of the understanding that browser detection using the user agent string is not advised as browsers can disguise themselves as a different one. But how much of a problem is this really?
Go to the top of the page
 
+Quote Post
MikeHopley
post May 21 2008, 07:19 AM
Post #2


Squeeze Machine
Group Icon

Posts: 677
Joined: 15-February 08
From: UK


IE6 is fundamentally broken. Don't spend too much heartache trying to improve the existing solutions.

I would strongly advise against browser detection using any method apart from IE-only conditional comments. Browser-sniffing is evil. Opera in particular frequently identifies itself as IE.

It's really not that big a deal. So there's a short delay. So what?
Go to the top of the page
 
+Quote Post
djeyewater
post May 21 2008, 09:57 AM
Post #3


Squeezing
***

Posts: 81
Joined: 18-February 08


QUOTE (MikeHopley @ May 21 2008, 08:19 AM) *
IE6 is fundamentally broken. Don't spend too much heartache trying to improve the existing solutions.

I would strongly advise against browser detection using any method apart from IE-only conditional comments. Browser-sniffing is evil. Opera in particular frequently identifies itself as IE.

It's really not that big a deal. So there's a short delay. So what?


It is a big deal for me, as the main content of my site is pngs with transparency, and the way IE6 renders them just makes the site look really messy (at least I think so). As far as I'm aware, IE6 is still the dominant browser so as much as I hate it and would like to give its users a worse experience to encourage them to use a real browser, I need my site to display properly in it.

Examples of browser sniffing I've seen always check that the user agent string contains IE and not Opera, in some cases does Opera identify itself as IE without mentioning IE as well?

Your point about IE conditional comments gives me an idea though, what about including some javascript or a meta refresh tag in a conditional comment that reloads the page with a url query string (or maybe use some AJAX) so the server can tell if the browser is IE6 and then serve up appropriate content?
Go to the top of the page
 
+Quote Post
MikeHopley
post May 21 2008, 10:07 AM
Post #4


Squeeze Machine
Group Icon

Posts: 677
Joined: 15-February 08
From: UK


QUOTE (djeyewater @ May 21 2008, 03:57 PM) *
It is a big deal for me, as the main content of my site is pngs with transparency, and the way IE6 renders them just makes the site look really messy (at least I think so).


A fair point, but I think you're probably stuck with that behaviour if you want to use alpha-masked PNG's. sad.gif

QUOTE
As far as I'm aware, IE6 is still the dominant browser so as much as I hate it and would like to give its users a worse experience to encourage them to use a real browser, I need my site to display properly in it.


I'm not advocating that you ignore IE, but only that you learn what things are practical in it. IE6 hacks for PNG transparency have been done to death, and I'd be surprised if you found a way to improve on the known solutions.

QUOTE
Examples of browser sniffing I've seen always check that the user agent string contains IE and not Opera, in some cases does Opera identify itself as IE without mentioning IE as well?


Opera is well known to fool browser sniffing scripts. I can't offer more technical information, because I avoid these things like the plague. It's a bad road to travel.

QUOTE
Your point about IE conditional comments gives me an idea though, what about including some javascript or a meta refresh tag in a conditional comment that reloads the page with a url query string (or maybe use some AJAX) so the server can tell if the browser is IE6 and then serve up appropriate content?


Sure, but won't you still be stuck with the same problem? How are you going to render transparent PNG's in IE6 without a slight delay for the MS alpha image loader? All the PNG-fixing methods rely on this proprietary filter, and that's what causes the delay.
Go to the top of the page
 
+Quote Post
welshstew
post May 21 2008, 10:08 AM
Post #5


Squeezing
***

Posts: 82
Joined: 14-February 08
From: inside the outside


check out my post here http://www.thewebsqueeze.com/forum/index.p...ost&p=12261

it will show you that you can produce transparent png's using fireworks that will work in the majority of browsers, including ie6.

This post has been edited by welshstew: May 21 2008, 10:08 AM


--------------------
Go to the top of the page
 
+Quote Post
Ross
post May 22 2008, 05:18 PM
Post #6


Rapid Squeezer
Group Icon

Posts: 155
Joined: 14-February 08
From: The t'interweb


QUOTE (welshstew @ May 21 2008, 04:08 PM) *
check out my post here http://www.thewebsqueeze.com/forum/index.p...ost&p=12261

it will show you that you can produce transparent png's using fireworks that will work in the majority of browsers, including ie6.


Nice one Stew biggrin.gif. I have been using JS hacks for too long but I will be giving this a go now biggrin.gif

Cheers,

Ross


--------------------
Go to the top of the page
 
+Quote Post
djeyewater
post May 23 2008, 08:28 AM
Post #7


Squeezing
***

Posts: 81
Joined: 18-February 08


After doing some testing it seems that IE6 will wait for all filtered pngs to download completely before displaying them, rather than displaying them as they are downloaded like a modern browser does.

Thanks for the suggestion on PNG8, I tried it but my images are circles and got jaggedy edges when displayed on a different background colour to the matte.

The js I was using previously waited for all pngs to load and then applied the filter, which mean the page looked a real mess until everything finished loading and the filter was applied.

Using the script Mike suggested I found only the first couple of images would load unfiltered, then you need to wait while all pngs are downloaded and filtered, then all pngs would be displayed filtered. Any new pngs displayed would be filtered.

Using a server side solution no unfiltered pngs would load and you just have to wait for them to all be downloaded and filtered before they are displayed. Any new pngs will displayed unfiltered unless you have typed the necessary code for IE6 for each png or setup a script/function to do this for you.

I think I like the js solution Mike suggested best, I think I can live with a couple of unfiltered images loading before the filter kicks in. I'm actually using a slightly different script, I found the twin helix one didn't get on well with my lightbox script.

Thanks for your help with this.

Dave
Go to the top of the page
 
+Quote Post
If you found The Web Squeeze to be helpful, please donate so we can keep this site FREE, FRESH, and fortified with Web Design & Development info!
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No New Posts   8 MikeHopley 358 30th September 2008 - 03:13 PM
Last post by: MikeHopley
No New Posts   9 Jacob.R 493 26th September 2008 - 04:24 AM
Last post by: Jacob.R
No new   17 Simon88 424 7th November 2008 - 09:20 AM
Last post by: karinne
No New Posts   7 unitedcraig 335 2nd December 2008 - 12:03 PM
Last post by: Simon
No New Posts   3 mcdanielnc89 94 22nd December 2008 - 10:43 PM
Last post by: mcdanielnc89