Web design seattle - JavaScript Programmer’s Reference break; case “NO” : //
Friday, November 9th, 2007JavaScript Programmer’s Reference break; case “NO” : // Fall back to the legacy browser, no layers page break; default: // Unexpected condition handled here break; } Because we need to know what browser and version the code is being run on to determine simulation capabilities, those get set as member properties of the isAvailable object. Later you could add capabilities to access the DOM feature-detection mechanisms so that all these related feature-detection facilities are in a single reusable code block. Note that the appVersion value picks up the Mozilla/X.YY value and uses that. This means that MSIE 5 reports an appVersion of 4 and Netscape version 6.0 reports an appVersion of 5, which is odd to say the least. You can do a bit more work to parse out the correct version numbers from the remainder of the user agent string or access special values that are platform dependant within a fragment of code that is selected on a per platform basis. Example code: