URL: http://www.uburst.com/cgi-bin/dcforum/dcboard.cgi
Forum: ushp_general_purpose
Thread Number: 423
[ Go back to previous page ]

Original Message

Posted by Ron Harter [rgharter@pacbell.net] on at 10:24 PM
I found something interesting on the Amazon web site and wonder if it is something I should use.
I am not a programmer but it looks like it may be checking to see which browser the customer is using. I don't know how much will show up in this forum but I will give it a try:

script language="JavaScript1.1" type="text/javascript"
var agt=navigator.userAgent.toLowerCase();
var is_major = parseInt(navigator.appVersion);
var is_nav = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
&& (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
&& (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
var is_gecko = (agt.indexOf('gecko') != -1);
var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
var is_aol = (agt.indexOf("aol") != -1);
var is_opera = (agt.indexOf("opera") != -1);
var is_win = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );

I also noticed they specify javascript1.1 rather than just javascript.
Maybe you can shed some light on this.

Table of contents

Messages in this discussion
"RE: Javascript"
Posted by Bill Weiner on at 06:42 AM
Yes, it looks like the JavaScript is just trying to determine the browser type. They must have other JavaScripts on their page that need to know the browser type ... probably for formatting reasons.

And as for the specification of JavaScript 1.1 instead of just JavaScript, that is just to ensure that JavaScript 1.1 is used since that is the syntax/functions used in their script. Without that specification, the browser would just use it's default... which may/may not be JavaScript 1.1.

With uShop's Java Applets and JavaScripts, there is no reason why you would need to use such a JavaScript.