Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > IE 5 specific version detect

IE 5 specific version detect
Thread Tools
Addicted to MacNN
Join Date: Sep 2000
Status: Offline
Reply With Quote
Jul 4, 2002, 02:02 PM
 
I want to detect a specific version of Internet Explorer: 5.1 for Mac only. Does anyone have a good JS that would work to detect that specific version, not IE 5 in general, or IE 5 cross platform.
I always use protection when fscking my Mac... Do you?
     
Mac Elite
Join Date: Mar 2001
Status: Offline
Reply With Quote
Jul 4, 2002, 07:34 PM
 
Basically what you need to do is to get the browser's USER_AGENT property. You then need to parse the string and search for "MSIE" which will indicate that it's a Microsoft Browser. You'd also need to look for the version and machine string (i.e. "Macintosh" or "PowerPC"). Here's a link for ASP developers but since VBSCript is almost English, you'll be able to understand it and turn it into client-side javascript (if that's where you want to detect it).

<a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnproweb/html/summaryofbrowserdetectiontechniques.asp" target="_blank">http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnproweb/html/summaryofbrowserdetectiontechniques.asp</a>

Talks about:

"The navigator object, a sub-object of the main top-level window object, provides the three useful properties userAgent, appName and appVersion. The userAgent property contains the string that completely identifies the browser, and is sent to the server in the HTTP headers with each page request it makes. The appName and appVersion properties are available only in client-side script, and contain the manufacturer's name and the browser version in a more readable format."

-Raman
     
Grizzled Veteran
Join Date: Jun 2001
Location: Melbourne, Australia
Status: Offline
Reply With Quote
Jul 4, 2002, 08:12 PM
 
Here's a handy Javascript for you:

var browser = new checkBrowser();

function checkBrowser() {
this.browser = navigator.userAgent.toLowerCase();
this.version = navigator.appVersion.toLowerCase();
this.mac = this.version.indexOf("mac")!= -1 ? 1 : 0;
this.ns = (this.browser.indexOf("mozilla")!=-1&&this.browser.indexOf("compatible")==-1&&document.layers) ? 1 : 0;
this.ie = (document.all) ? 1 : 0;
this.dom = (document.getElementById) ? 1 : 0;
this.domie = (this.dom&&this.ie) ? 1 : 0;
this.domns = (this.dom&&!this.ie) ? 1 : 0;
this.min = (this.ns&#0124;&#0124;(this.ie&&(t his.mac&&this.version.indexOf("msie 4")!=-1))&#0124;&#0124;this.dom);
return this;
}

In most cases (damn nearly all!) it will properly determine which kind of browser DOM you are using, and any extra information that is necessary (like Mac compatibility).

It also has a browser.min property which you can use to test for proper DHTML functioning (it does not provide for IE4 or 4.5 for Mac which was pretty hopeless anyway). It also makes a distinction between the new DOM of IE5/6 and NS/Mozilla 6+ which can vary ever-so-slightly in implementation.

This script is a collection of hints and tips I've seen on places like <a href="http://www.dynamicdrive.com" target="_blank">http://www.dynamicdrive.com</a> and <a href="http://www.hotscripts.com" target="_blank">http://www.hotscripts.com</a> so use it to your heart's content.

<small>[ 07-04-2002, 09:14 PM: Message edited by: Simon Mundy ]</small>
Computer thez nohhh...
     
Addicted to MacNN
Join Date: Sep 2000
Status: Offline
Reply With Quote
Jul 5, 2002, 12:37 PM
 
</font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">&lt;SCRIPT LANGUAGE=&quot;JavaScript&quot;&gt;
&lt;!--
document.write(navigator.userAgent)
//--&gt;
&lt;/SCRIPT&gt;</pre><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">Provides "Mozilla/4.0 (compatible; MSIE 5.14; Mac_PowerPC)" which is good...

But does anyone know of a foolproof way to get the version number "5.14" isolated? Even in cases such a "5.1" or whatever else they may do in the future "5.2.1" or "6"... I need to get just the version number, regardless of how long or short it is.
I always use protection when fscking my Mac... Do you?
     
   
Thread Tools
Forum Links
Forum 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
Top
Privacy Policy
All times are GMT -5. The time now is 10:34 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2