NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Loading different images depending on the browser (JavaScript)

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 04-02-2004, 09:50 AM THREAD STARTER               #1 (permalink)
New Member
Join Date: Mar 2004
Posts: 9
Nevsan is an unknown quantity at this point
 



Loading different images depending on the browser (JavaScript)


I have an interesting problem... The way my page is designed, I use a lot of transparent images, so I use the .PNG format (Mostly to get dropshadows). Thing is, IE for Windows, doesn't seem to support the transparency so my sit ends up looking horrible. What I was wondering, is if it is possible to use a JavaScript or something to detect what browser is being used, and then load a different .GIF image (Without dropshadows)... I could just scrap the dropshadows in general but I would like to keep them for people with browsers that do support .PNG transparency...

Also, since my layout is completely CSS based (not a single table), I was wondering if I could to the same for background images, since a few browsers support .PNG transparency for background images too... (The url's of the background images are stored in the style sheet so I don't think JavaScript can help here, but it's worth asking.)
????: NamePros.com http://www.namepros.com/programming/25458-loading-different-images-depending-browser-javascript.html

If you want to see what I mean when I say it renders horribly in Windows IE, take a look at this:

http://homepage.mac.com/nevsan/

It renders fine in Mac browsers though. I think Opera for Windows might render it correctly, so try that out to see what it's supposed to look like. Here's a screenshot of what it's supposed to look like.


P.S. While I'm here, any way to get rid of that 2 pixel spacing between div elements that ieWin seems to throw in there?
Nevsan is offline  
Old 04-03-2004, 05:52 PM   #2 (permalink)
NamePros Member
 
OneEyedDog's Avatar
Join Date: Mar 2004
Location: Middle Earth (NZ)
Posts: 149
OneEyedDog is on a distinguished road
 



Not so inline with PNG transparency but a technique I was looking at two days ago is here:

http://www.alistapart.com/articles/cssdropshadows/

Hope this helps in anyway,

Warm Wishes,
__________________
Script Installation, Avatars, Banners and Buttons for $NP or Paypal, PM me your requirements :D
Deni J Vanin | Freelance Jobs and Forums | Web Design
OneEyedDog is offline  
Old 04-03-2004, 07:26 PM   #3 (permalink)
NamePros Expert
 
Anthony's Avatar
Join Date: Dec 2003
Location: NYC
Posts: 9,134
Anthony has a brilliant futureAnthony has a brilliant futureAnthony has a brilliant futureAnthony has a brilliant futureAnthony has a brilliant futureAnthony has a brilliant futureAnthony has a brilliant futureAnthony has a brilliant futureAnthony has a brilliant futureAnthony has a brilliant futureAnthony has a brilliant future
 

Member of the Month
October 2004

I would recommend going with .gifs for transparency, since it doesn't look like IE will be supporting .png transparency anytime soon.
Anthony is offline  
Old 04-04-2004, 10:36 AM THREAD STARTER               #4 (permalink)
New Member
Join Date: Mar 2004
Posts: 9
Nevsan is an unknown quantity at this point
 



So I guess I'm SOL here? Damn. Those drop-shadows looked good too . Frickin' IE. I hate it. Funny how all hacks seem to target IE since it screws everything up, and yet it just happens to be the most popular browser. God I hate MS....

Oh, one more thought. Do you think it would be reasonable to, maybe, set up a PHP script or something so it loads different stylesheets/html pages depending on the browser or platform? I actually know nothing on PHP, but I already know C/C++ so it shouldn't be too hard.... Wait, would a webhost such as, say, .Mac, even let me use PHP?
Last edited by Nevsan; 04-04-2004 at 10:40 AM.
Nevsan is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 12:13 PM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger