473,395 Members | 1,383 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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.

Feb 11 '06 #1
4 1131

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

Danny
Feb 11 '06 #2

Amanda H. napisal(a):
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.


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

Feb 11 '06 #3

Amanda H. napisal(a):
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.


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

Feb 11 '06 #4
Thanks guys, got an Alpha.Imageblahblahblah filter to work! :)

Feb 11 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: R. Rajesh Jeba Anbiah | last post by:
Anyone knows how ASP detects frame? I couldn't find any PHP solutions yet. TIA -- | Just another PHP saint | Email: rrjanbiah-at-Y!com
12
by: Kepler | last post by:
How do you get the height of the client browser in IE? Both document.body.clientHeight and document.body.offsetHeight return the height of the document. If the page is long and there's a vertical...
9
by: WRH | last post by:
Hello I am new to asp but I made some Jscript functions which work fine. The functions contain some strings used as a registration key for some apps. It is important that these strings not be...
15
by: David Thielen | last post by:
Hi; My ASP.NET app (C# calling J# under .net 2.0) creates a png file in a subdirectory to display as part of the created page. However, the bitmap will not display due to a security violation. ...
8
by: Amanda H. | last post by:
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...
0
by: etnaelk | last post by:
Hi all, I have a real bugger of a problem that I just haven't been able to figure out. I am working on writing my own proxy server in C# using TcpListener, TcpClient, HttpWebRequest/Response and...
1
by: kksandeep | last post by:
i am using this three files to uplod file. i got this file from net but i think these have some error. i am new to this field plz help the script i found is some helpful but not too that i need ...
1
by: CompletelyUseless | last post by:
Hi, I'm having a lot of troubles trying to build a function to figure out the difference (in color) between two images. I've tried to build something similar with the ImageMagick API, but I've...
1
oranoos3000
by: oranoos3000 | last post by:
hi would you please help me i have a online shopping center that i show pictures of the my product in home page. in the InterExplorer pictures is shown correctly but in Firefox browser is shown...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.