Connecting Tech Pros Worldwide Help | Site Map

JS Detects Browser, Then Replaces Images/Code/CSS

 
LinkBack Thread Tools Search this Thread
  #1  
Old February 11th, 2006, 12:35 AM
Amanda H.
Guest
 
Posts: n/a
Default JS Detects Browser, Then Replaces Images/Code/CSS

Hi guys,

I just started switching my site over to tableless css, and I'm using a
very lovely, transparent PNG-24 image. I have been trying to figure
out if there is any way to replace an image before loading only for
certain browsers using either javascript or PHP (I'm using PHP to
switch stylesheets and prefer server-side).

The problem is IE's handling of PNG-24 files: every other browser has
alpha compatibility and displays PNG-24 images correctly, even IE/Mac.
But IE/Win shows the transparent areas as blue. This is a commonly
known bug that I haven't been able to find a definitive fix for.

What I want to happen is for the JS or PHP to detect if the browser is
IE/Win. Then, if so, replace the code or load an alternate css
stylesheet to display a GIF instead of the PNG. I am mostly using the
PNG-24 in a div as a background-image in an external stylesheet.

Anyone had any idea if this is possible? I only have a meager
understanding of javascript and PHP, so any help would be greatly
appreciated.

Thanks,

Amanda H.


  #2  
Old February 11th, 2006, 01:35 AM
Danny
Guest
 
Posts: n/a
Default Re: JS Detects Browser, Then Replaces Images/Code/CSS


Check on using the ie-hack -> http://homepage.ntlworld.com/bobosola/
<-

Danny
  #3  
Old February 11th, 2006, 12:45 PM
Luke Matuszewski
Guest
 
Posts: n/a
Default Re: JS Detects Browser, Then Replaces Images/Code/CSS


Amanda H. napisal(a):[color=blue]
> The problem is IE's handling of PNG-24 files: every other browser has
> alpha compatibility and displays PNG-24 images correctly, even IE/Mac.
> But IE/Win shows the transparent areas as blue. This is a commonly
> known bug that I haven't been able to find a definitive fix for.[/color]

Yet there are some common working workarounds. See:

<URL:http://dean.edwards.name/IE7/>

or simply:

<URL:http://koivi.com/ie-png-transparency/>

(the solution from http://homepage.ntlworld.com/bobosola/ is not very
elegant).

B.R.
Luke Matuszewski

  #4  
Old February 11th, 2006, 12:45 PM
Luke Matuszewski
Guest
 
Posts: n/a
Default Re: JS Detects Browser, Then Replaces Images/Code/CSS


Amanda H. napisal(a):[color=blue]
> The problem is IE's handling of PNG-24 files: every other browser has
> alpha compatibility and displays PNG-24 images correctly, even IE/Mac.
> But IE/Win shows the transparent areas as blue. This is a commonly
> known bug that I haven't been able to find a definitive fix for.[/color]

Yet there are some common working workarounds. See:

<URL:http://dean.edwards.name/IE7/>

or simply:

<URL:http://koivi.com/ie-png-transparency/>

(the solution from http://homepage.ntlworld.com/bobosola/ is not very
elegant).

B.R.
Luke Matuszewski

  #5  
Old February 11th, 2006, 01:55 PM
Amanda H.
Guest
 
Posts: n/a
Default Re: JS Detects Browser, Then Replaces Images/Code/CSS

Thanks guys, got an Alpha.Imageblahblahblah filter to work! :)

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.