It should be allowed to form part of the site's overall structure. The Script is a great utility for controlling traffic on any site, and especially for webmasters not being able to use server scripts, it or a similar system is almost a necessity. For the Script to work as intended, a few things need to be prepared, but first let's try it out.
If you were to check the source of the current HTML file, you would find that the script
code is placed near to the top in the
HEAD, having already made your browser go and get all the
The script source files are containing the default settings ( -- no tricks!).
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, or the site would look amateurish. Here's where you need the Script, because it knows all
relevant features about old and new browsers alike. Here's where you put the
HEAD script. It is
written to not break any browser in any way. Ten year old impossible applications like Netscape
Navigator 2 or Internet Explorer 3 will instantly be taken care of and nicely turned away
from the site towards the FallBackUponURL, while the remainder will be handled the ways you
decide. Put the following code snippet in the
HEAD section of
the document. It is HTML4 Strict standards compliant. There is also an alternative XHTML compliant version.
(The code version number must not be lower than 2.2 to function properly.)
Note that there is one limitation though; the Sniff and Divert Script knows nothing about the circa 5-10% of
page with a
NOSCRIPT section, as elaborate as you think necessary and appropriate.
Before beginning to install the script code, you should know the location for and having prepared an HTML 3.2 web page for a dated technology, which you (simply put) refrain from supporting. This page are adviced to be one and the same for the whole site, even if the Sniff and Divert Script is used multiple times. As an example, please check the fallback page we use at the PM site.
Since the Entry page is accustomed to all sorts of browsers, standards and non-standards alike, it's advicable to keep it simple and save the flashy stuff for subsections of the site, where you exactly know which browser technology to deal with. The Sniff and Divert Script has developed methods to deal with the relocation of diverse technologies to specific subsections. The approach is to subdivide (parts of) the site into a main directory suited for the lion share of the site and an alternative directory.
The alternative pages are there for older or otherwise limited browsers or computer environments, which cannot
render modern web pages satisfactory. You should decide on the required conditions for the main (normal) part
of the site (easily done by filling out the form below), and then all complying browsers and environments will
get the document from a named sub directory of your choosing (e.g. "yourMainPages/doc/").
Environments or browsers, which are limited in scope, such as low resolution screens or Netscape
Navigator 4, will get an alternative document from another named sub directory of your choosing (e.g.
The script will make the location change to another directory (by default keeping the name of the original
file) or to another file in the same directory. It will do this applying either the method
"SomeURL" or the optional method
location.replace("SomeURL"). In the first instance the browser is
"moving on" to another location and thereby marking a new entry in the history sequence, compared
to the second instance where the browser rather "replace" the current history mark with another.
The Script doesn't make the relocation compulsory, though. It may easily be configured to deal with many kinds of scripts, while remaining at the current location. Then we say the mode of the Script is in ScriptAction mode rather than Relocation mode.
To work, the script uses two external script files, of which one is ready-made (29 kB) and doesn't need any modifications. The hyperlinked document below will bring you info about this script file. The second external script, you are supposed to generate yourself by use of the form farther below.
Now is the time to create the generated CustomScriptFile.js script source file. At the bottom of 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, which is quickly accomplished by filling out the form.
The code version number must not be lower than 2.4 to function properly.
Having selected and pasted the generated code (see the form above) in a script source file named "CustomScriptFile.js" or anything you choose, and saved it in a convenient location, there is only the customizing of the primary document (the Entry page) left not to forget. Check the location and name for CustomScriptFile.js and uaenvirsniff.js. Substitute your own link for the faked yourFallBackUponURL.htm relocation link.
To initiate the Script, you could use an event handler, such as onLoad or onClick. The function to call is "Init".
That's it. No more frustrated surfers will choose another website or even send you angry emails.
© 2001-2004 The Script is FREE FOR USE if author info is provided.