Browser Compatibility
Create alternate
versions to support multiple browsers
If you want to use new Web technologies, such as
layers, frames, or JavaScript, and you also want your site to be
accessible to people who use lower level browsers and old screen
readers, then you will need to create an alternate version of your
site. The alternate version should be produced without relying on
frames.
Make use of
browser sniffers
Use a browser sniffer to determine which site
version should be sent to each user. Sniffers use a scripting language
like JavaScript or CGI to determine various aspects about the user's
browser, such as its version, level of JavaScript, browser name,
ability to interpret Java, installed plugins, etc. The example HTML
file below will load one of three HTML pages when the link is clicked.
It determines which page to load based on the version of JavaScript
supported on the browser.
<html><head><title>JavaScript Browser Sniffer</title></head>
<!-- Find out what level of JavaScript they support. -->
<!-- 10 is for Navigator 2.0 and Internet Explorer 3.0 -->
<!-- 11 is for Navigator 3.0 and Internet Explorer 4.0 -->
<!-- 12 is for Communicator 4.0 -->
<script language="JavaScript">
<!--
ver = 10;
//-->
</script>
<script language="JavaScript1.1">
<!--
ver = 11;
//-->
</script>
<script language="JavaScript1.2">
<!--
ver = 12;
//-->
</script>
<script language="JavaScript">
<!--
function nextPage()
{
//
// If the browser is one of the 4.0 browsers we will use
latestver.html
// Otherwise we will see if they have JavaScript 1.1 before using
newver.html
// Defaulting to oldver.html for everyone else.
//
if (navigator.userAgent.indexOf("4.0") >= 0) {
window.location = "latestver.html";
} else if (ver >= 11) {
window.location = "newver.html";
} else {
window.location = "oldver.html";
}
}
// -->
</script>
<body>
<!-- Place oldver.html on the anchor for those browsers without
JavaScript -->
<a href="oldver.html" onClick="nextPage(); return false;">my link
text</a>
</body>
</html>