The Browser and Environment Client-Side JavaScript Sniff and Divide Scripts System, version 3.1
What’s it all about?
The script will sniff for old and dated or generally incapable browsers and see to it that these won't be
broken by too complex script or hyper text markup code, but instead that the clients be diverted to an
appropriate message on a simplified web page, or relocated to an alternative section of the site, or be given a
simpler script code to interpret. Probably you would like to use fresh technologies, but at the same time not
lose visitors, just because not everybody updated their browsers or computers in a while. All this can
be accomplished seamlessly by the use of client-side JavaScript, and all appropriate functions utilized are
highly adjustable with this script.
It should preferably be allowed to form part of the site's overall structure, since it's a
great utility for redirecting traffic on any site, and for webmasters not being able to use server
scripts, it is even more precious.
Preparations
For the script to work as intended, a few things need to be prepared.
The Entry Page and NOSCRIPT section
A client will enter your site (or a section of it) at an entry point. This is where you should expect
any browser to come stumbling in. The page at this primary location in the site's structure must
cater for anything. Here's where you need the script, because it
finds out all relevant features about old and new browsers alike. On this page a part of the script is put, which
should not break any browser in any way. Ten
year old impossible applications like Netscape Navigator 2 or Internet Explorer 3
is instantly be taken care of and nicely turned away from the site towards the
FallBackUponURL, while all other browsers are handled the way you decide.
Note that there is one limitation though; the Sniff and Divide Script knows nothing about the
circa 5-10% of browsers out there going about the web without JavaScript made available. Therefore you'd need
to prepare the Entry page with a NOSCRIPT section, as elaborate as you think necessary and
appropriate. If you can read "MyNextLocation" as a heading on the next line, than your browser skipped
the contents between the NOSCRIPT tags just below, and that is enough proof, this browser is script enabled.
MyNextLocation
Since the Entry page is accustomed to all sorts of browsers, standards and non-standards alike, it should be
kept simple and the technically advanced stuff reserved for subsections of the site. The script is utilizing methods to
deal with the relocation of diverse technologies to specific subsections of the site.
By default
the script would let specific, competent browsers make the current location change to another location in a subdirectory (optionally
keeping the name of the original file) or simply go on to another file in the same
directory.
The script doesn't make the relocation compulsory, though. It lets itself be configured to deal with customized
script code, and yet let the client remain at the current location. Then we say the
script is in ScriptAction rather than a Relocation mode. More about that later.
MyFallBackUponURL
Before beginning to customize the script code, you should know the location for and having prepared an
HTML 3.2 web page for dated technologies. That web page
is (for convenience) advised to be one and the same for the whole site. As an example, please check this fall-back page.
uasniff.js and uaenvir.js
The script depends on two external script source files:
The first of these source files will possibly contain some script code you generate yourself below.
For more information about the script files, go to the Demonstration page.
Now is the time to choose a particular script (mode) and (optionally) generate the script code to add to the
uasniff.js file. Further down this page, you could click a button to have the script code
generated already this very minute, but of course you should adapt it to your site's particular needs. This is
quickly accomplished by doing some clicking in this section. The code that you then will generate, should
either be copied and pasted into the uasniff.js file, or put on the Entry page
Please note that any green field is an
indication to you and a recommendation to do adjustments to the code, while the yellow fields are only for minor adjustments, and can be dealt with
later, if at all.
Disclaimer: Please, notice that although the script code is believed to work with all current and
correctly working JavaScript browsers, it should be applied with care. There is NO WARRANTY of its
proper behaviour, and it is offered to the public AS IS, the author refraining from admitting ANY RESPONSIBILITY
WHATSOEVER for unexpected results when use is made of it, EVEN IF USED AS INTENDED. The author would REJECT ANY
CLAIM for financial or any other loss supposedly because of it.