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.
|
|
|
|
|
![]() |
||
Browser detection IE mac
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
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"> |
|
|
|
|||
|
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. |
![]() |
| Tags |
| browser, detection, mac |
| Thread Tools | |
|
|
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 |