Browser detection IE mac

This is a discussion on "Browser detection IE mac" within the JavaScript Forum section. This forum, and the thread "Browser detection IE mac are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Aug 1st, 2007, 11:16
New Member
Join Date: Jul 2007
Location: london
Age: 33
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Browser detection IE mac

I've added a dreamweaver behaviour onto a webpage because my newly designed css site doesn't work on mac IE 5.2 (but appears to work on pc IE and firefox and mac safari and firefox).

I'm happy for this to be the case but would like the browser detection to redirect those on mac IE to a new page which recommends they look at the site in the other browsers.

The behaviour works fine but also redirects those on the pc as well. I only want the redirect to work on the mac. How do I amend the code to do this?

http://www.blazedevelopment.net/gold...index_mac.html

<script type="text/javascript">
<!--
function MM_checkBrowser(NSvers,NSpass,NSnoPass,IEvers,IEpa ss,IEnoPass,OBpass,URL,altURL) { //v5.0
var newURL='', userAgent=navigator.userAgent, version=0;
if (userAgent.indexOf('Netscape') != -1) {
version = parseFloat(userAgent.substring(userAgent.indexOf(' Netscape')+9,userAgent.length));
if (version >= NSvers) {if (NSpass>0) newURL=(NSpass==1)?URL:altURL;}
else {if (NSnoPass>0) newURL=(NSnoPass==1)?URL:altURL;}
} else if (userAgent.indexOf('MSIE') != -1) {
version = parseFloat(userAgent.substring(userAgent.indexOf(' MSIE')+4,userAgent.length));
if (version >= IEvers)
{if (IEpass>0) newURL=(IEpass==1)?URL:altURL;}
else {if (IEnoPass>0) newURL=(IEnoPass==1)?URL:altURL;}
} else if (OBpass>0) newURL=(OBpass==1)?URL:altURL;
if (newURL) { window.location=unescape(newURL); document.MM_returnValue=false; }
}
//-->
</script>


<body onload="MM_checkBrowser(4.0,2,2,4.0,2,2,0,'index.h tml','mac_users.html');return document.MM_returnValue">
<div id="goldenball_splash" onfocus="MM_checkBrowser(4.0,1,2,4.0,2,2,0,'index. html','mac_users.html');return document.MM_returnValue">
Reply With Quote

  #2 (permalink)  
Old Aug 1st, 2007, 11:28
SuperMember

SuperMember
Join Date: May 2007
Location: UK
Age: 27
Posts: 1,111
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Browser detection IE mac

Ugh. I shiver from looking at that code.

This advice is not what you're looking for, so feel free to ignore it: don't use browser detects. They are a relic of the Bad Old Days.

There is no reliable, safe way to help IE5/Mac. You can try nasty, unstable CSS hacks, or you can use an unreliable browser detection script (note that browsers can spoof their identity; Opera often identifies as IE).

But why do this? IE5/Mac has absolutely minuscule browser share nowadays. The latest stats from theCounter.com show that IE5 has 1% browser share; and of that 1%, the vast majority will be PC users.

The only "clean" hacking option is conditional comments for IE, but these won't discriminate between IE5/Win and IE5/Mac.

In my view, modern web design should involve minimal hacking. It's a squalid, pitiful way to work. The only hacks should be for browsers with overwhelming market share -- IE6 and IE7 -- because you simply cannot afford to alienate those users. For browsers with less than 1% market share, it's simply not worthwhile to hack (and don't forget: their market share is dwindling).

Okay, so there's no harm hacking for IE5 -- because conditional comments make it easy and safe. But it's not worth much heartache. I give IE5 about 5 or 10 minutes of my time.

Still, if you insist on using browser detects, this quirksmode article should solve your problem.

Last edited by MikeHopley; Aug 1st, 2007 at 11:41.
Reply With Quote
Reply

Tags
browser, detection, mac

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
javascript detection yvettesio JavaScript Forum 2 Feb 12th, 2007 23:58
ie mac detection jimz JavaScript Forum 2 Jul 27th, 2006 22:07
Field Name Detection accessman Databases 1 Oct 4th, 2005 07:53
Browser size detection?! courtjester Web Page Design 1 Aug 26th, 2004 07:03
Problem with DTHML Browser detection/redirection mjance Web Page Design 3 Oct 15th, 2003 19:02


All times are GMT. The time now is 22:33.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43