Log in

View Full Version : Redirect based upon IE6 or IE7



Hummell
03-06-2008, 09:08 PM
Hey guys! Question for you. I have an HTML dashboard, as some of you know, that I maintain for my company. On the dashboard, I display separate .gif images in cells of the dashboard table. This has worked fine in the past, and continues to work fine. The problem is, the gif images are grainy.

I've been experimenting with the .png file extension and the quality of the images is WAY better. Problem is, <IE7 displays the background of .png files grey, rather than transparent.

I found out that some associates in our company actually use IE7 and some are still on IE6. I'd like to be able to redirect the users, based upon their browser version (no one uses anything but Internet Explorer...the company is also an intranet site...so 6 and 7 are the only versions to worry with).

I can create 2 dashboards. One that uses .png files for the images and one that uses .gif files.

I currently have a redirect page that shows a loading bar when the site is accessed. Within this loading page, I'd like to put some redirect script that sends users with IE6 to the .gif dashboard and users with IE7 to the .png dashboard.

Does anyone have any thoughts?

Thanks!
-Hum

Hummell
03-06-2008, 09:21 PM
So I guess the script would be something like this? Can anyone tell me if this looks right? I tried to modify the script off of the Dynamic Drive sripts site.

<script>

var browser_type=navigator.appName
var browser_version=parseInt(navigator.appVersion)

//if IE 6
if (browser_type=="Microsoft Internet Explorer"&&browser_version=6)
window.location.replace("http://dashboard.gif.com")
//if IE 7
else if (browser_type=="Microsoft Internet Explorer"&&browser_version=7)
window.location.replace("http://dashboard.png.com")
//Default goto page (NOT IE 6 and NOT IE 7)
else
window.location="http://dashboard.gif.com"
</script>

Hummell
03-07-2008, 01:37 PM
:)Any ideas?

molendijk
03-07-2008, 02:13 PM
Use conditional statements for IE6 & 7. Something like this:


<script type="text/javascript">
function bla(){window.location="http://dashboard.gif.com"}
</script>

<!--[if IE 6]>
<script type="text/javascript">
function bla(){window.location.replace("http://dashboard.gif.com")}
</script>
<![endif]-->

<!--[if IE 7]>
<script type="text/javascript">
function bla(){window.location.replace("http://dashboard.png.com")}
</script>
<![endif]-->

Arie Molendijk

cecemf
08-15-2008, 10:51 AM
Can anyone tell me which one of this 2 to use ?

rangana
08-15-2008, 11:16 AM
Both (would) work, but I prefer to use that of molendjk.