 |
 |
need javascript help
|
 |
|
 |
|
Grizzled Veteran
Join Date: May 2002
Location: Houston, TX
Status:
Offline
|
|
Stupid IE on Windows.  Seems it is the only browser that does not render .png's with transparency (that I know of. If anyone knows another borwser that does this let me know). So I need to find a javascript that will redirect the user to one page if they are using IE on Win, and another page if they are using any other browser/OS combo. I've found scripts that redirect based on Win/Mac, and I've found scripts that redirect based on IE/Netscape(mozilla), but none that do both. And I'm not nearly a good enough coder to cobble those two together into a working form.
Does anybody know where I can get a script that does this? Or any super coders out there feel like writting one up quick?
Thanks.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Oct 1999
Location: San Jose, Ca
Status:
Offline
|
|
|
|
|
|
| |
|
|
|
 |
|
 |
|
Grizzled Veteran
Join Date: May 2002
Location: Houston, TX
Status:
Offline
|
|
Thanks for the quick response.
That's interesting, but not exactly what I'm looking for. I've allready got my pages made, one with PNGs and one with JPGs. The JPEG Win IE page doesn't look quite as good, but it will do. I just need a way to redirect Win IE users to that page instead of the normal one.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Dec 2001
Location: Atlanta, GA, USA
Status:
Offline
|
|
This should work:
Code:
<html>
<script language="JavaScript">
var agt=navigator.userAgent.toLowerCase();
if ((agt.indexOf("msie") != -1) && (agt.indexOf("windows") != -1))
{
//Windows Internet Explorer
document.location.href = "index_msiewin.html";
}
else
{
//Everybody else
document.location.href = "index_other.html";
}
</script>
</html>
|
|
Mac Pro 2x 2.66 GHz Dual core, Apple TV 160GB, two Windows XP PCs
|
| |
|
|
|
 |
|
 |
|
Grizzled Veteran
Join Date: Nov 2003
Location: Hebburn, UK
Status:
Offline
|
|
 to arkham_c, I was just about to post virtually the same thing. I would however point out that
Code:
filter: progid: DXImageTransform.Microsoft.AlphaImageLoader
would allow the windows IE users to see the .png... I know - who cares about IE/Win users, but it's nice all the same.
How about something along the lines of what is shown here:
http://forums.macrumors.com/archive/topic/50459-1.html
I was going to write this myself, but I needed to do a google search for the filter thing cos it's quite long, and i tend not to code for IE/win nowadays, so i couldn't remember it all
Anyhoo - I think it'll only work for ie5.5+ users, but it's good enough. Checking for "MSIE 6.0" in the userAgent string and directing them to your alphaImageLoader page, the good guys to your proper png page and the old time MSIE users to your jpeg page wouldn't be too hard...
|
|
|
| |
|
|
|
 |
|
 |
|
Grizzled Veteran
Join Date: May 2002
Location: Houston, TX
Status:
Offline
|
|
Originally posted by Arkham_c:
This should work:
Code:
<html>
<script language="JavaScript">
var agt=navigator.userAgent.toLowerCase();
if ((agt.indexOf("msie") != -1) && (agt.indexOf("windows") != -1))
{
//Windows Internet Explorer
document.location.href = "index_msiewin.html";
}
else
{
//Everybody else
document.location.href = "index_other.html";
}
</script>
</html>
mucho gracias! just what i was looking for! 
|
|
|
| |
|
|
|
 |
|
 |
|
Occasionally Useful
Join Date: Jun 2001
Location: Liverpool, UK
Status:
Offline
|
|
if you already have the images as both .jpg & .png, why not just use the same page? quite easy, really (assuming you have php access). just something like this would do the trick: [php]<?
if (strpos($_SERVER["HTTP_USER_AGENT"], "MSIE") !== false) {
$ext = "jpg";
} else {
$ext = "png";
}
?>
// check it returns the correct extension
<p>$ext = .<? echo $ext ?></p>
<img src="image.<? echo $ext ?>">[/php] no sense in coding 2 different sets of pages.
|
|
"Have sharp knives. Be creative. Cook to music" ~ maxelson
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Dec 2003
Status:
Offline
|
|
Ooh. philzilla, that's pretty clever. Good idea. 
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|