What does it do? Test it!
Put into a web page, it would either change the location to yourNormalPages/URL.htm or yourSimplePages/URL.htm, or divert to yourFallBackUponURL.htm, or do nothing.
What do we have to do?
You should select and copy the script code below, and paste it into the
HEAD section of a
(prominent) web page on your site. A few lines down the code, there is a link to a script source file
uasniff.js, which you should download and save as is, to the
same directory as the web page, or anywhere on your site.
BODY tag of the web page, you need to put an onload event handler to initiate
the script, or you could use any event handler to call the Init function (but do not call
Init until the document is fully loaded.):
So, what else?
NOSCRIPT tags. Preferably this web page should be written using HTML3.2 or HTML4
Transitional code. To facilitate maintenance of the site, I suggest use of the same code
here as on yourSimplePages:
Now, as you might have noted already, there are three placeholder URI's in the
HEAD script code, which should be replaced in
accordance with the site's paths, and there is also the possibility of optional modifications to the script
variables. Then, you're done :-)
OK, but what..?
HEAD code. (cp. above). Now, if the browser wasn't script compliant
yourSimplePages/URL would have been loaded by default. However, were the sniffAction
variable's keyword "pardon" removed, the browser would've been diverted to yourFallBackUponURL.
Although, in my example scenario, neither outcome would have been effectuated.
Internet Explorer 6 returns
true for ECMAScript compliance. It means it
might be welcomed to yourNormalPages/URL. It depends on the variable Dir2DOM
stated in the
HEAD code. (cp. above). The script has already found out about the
Document Object Model (DOM) the browser is applying, and since Internet Explorer
6 has implemented relevant parts of the W3C DOM (the
variable value "w3cdom"), that browser is clear for yourNormalPages/URL. It would even have been
clear if the Dir2DOM value had been changed to either "domelementstyle" or "msieapi". Had, on the contrary,
"domcreateevent" been set as a requirement, Internet Explorer 6 would have loaded
yourSimplePages instead, because that browser doesn't handle events according to the
The last thing happening is the use of the
HEAD code's Dir0 value to decide on the
relocation method. If you'd like the Script to try (not always possible) to apply the
location.replace("SomeURL") method, thereby causing no extra entry
into the history sequence, you should leave the value as it is by default. This would be useful in
the case of initiating the script on an
onLoad event, then saving the functionality of the
Back button. If you rather need the script to apply the
"SomeURL" method, when diverting the visiting browser to another location,
you should change the value to "HN". That would be useful in the case of initiating the script on an
onClick event, thereby marking another entry into the history sequence..