• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

29.6. Browser Detection

All of the DHTML examples we've looked at in this chapter depend on features of the DOM Level 1 and DOM Level 2 standards, which means that they only work in the latest web browsers, Netscape 6 and Internet Explorer 5.5. This means that if you use one of these examples, you must first check for the user's browser type and version, so that you can make sure that the browser supports the script. Each of the example scripts should begin like this:

<script language="JavaScript"> 
var isNN4, isIE4, isDOM;

if (document.getElementById) {
    isDOM = true;
}
else {
    if ( parseInt(navigator.appVersion) == 4) {
        if ( navigator.appName == "Netscape" ) {
            isNN4 = true;
        }
        if ( navigator.appName == "Microsoft Internet Explorer" ) {
            isIE4 = true;
        }
    }
}
</script>


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint