What does it do? Test it!
Put into a web page, it would either change the location to yourNormalPages/URL.htm, or divert to yourFallBackUponURL.htm, or do nothing.
What do I have to do?
You should select and copy the script code below, and paste it into the
HEAD section of a
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?
Now, as you might have noted already, there are two 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's Dir2Gen (cp.
above). If the value of the current browser is equal to or higher than the one stated, then the visitor will
be relocated to yourNormalPages/URL. Seeing that Internet Explorer 6 returns 5 for browser generation, it doesn't matter whether you change the default
value; that browser is always welcomed onto your site. Otherwise, it would have been diverted to
yourFallBackUponURL, which indeed Internet Explorer version 5 would go, if you
changed the requirement from 4 to 5 (thereby disregarding browsers not up to current standards). In fact, the even older
Netscape Communicator and Internet Explorer version 4 will both be diverted to your fallback location
no matter what.
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..