55Chapter 13 .JavaScript Essentials IE Browser Version Headaches (Web design tools)
55Chapter 13 .JavaScript Essentials IE Browser Version Headaches As described more fully in the discussion of the navigator object in Chapter 28, your scripts can easily determine which browser is the one running the script. However, the properties that reveal the version don t always tell the whole story about Internet Explorer. For one thing, the Windows and Macintosh versions of the same major browser version (3.0x) implement slightly different object models. The Mac version includes the ever-popular image object for mouse rollover image swapping; the Windows version does not, and any attempt to use such code in the Windows version results in script errors. Next, the first release of Internet Explorer 3 for the Macintosh was not scriptable at all the JavaScript interpreter was left out. Macintosh version 3.01 was the first scriptable Mac version. Even among minor generation releases of Internet Explorer 3 for Windows, Microsoft implemented some new features here and there. Probably the most troublesome problem is that an improved JavaScript interpreter (in the JScript.dll file) underwent substantial improvements between version 1 and version 2 for Windows. Many copies of browser version 3.02 for Windows shipped with version 1 of the .dll. Some users updated their browsers if they knew to download the new .dllfrom Microsoft. Unfortunately, the interpreter version is not reflected in any navigator object property. A nasty Catch-22 in this regard is that version 2 of the interpreter includes a new property that enables you to examine the interpreter version, but testing for that property in a browser that has version 1 of the interpreter installed results in an error message. Due to the insecurity of knowing exactly what will and won t work in a browser that identifies itself as Internet Explorer 3.0x, you might decide to redirect all users of Internet Explorer 3 to pages in your application that include no scripting. But before you think I m bashing Internet Explorer 3, you should also consider doing the same redirection for Navigator 2 users due to the number of platform-specific bugs that littered that first round of JavaScript. Object model and core language implementations in NN3+ and IE4+ are much more stable and reliable platforms on which to build scriptable applications (and you get genuine array objects!). If you have an opportunity to study the access logs of your Web site, analyze the proportion of different browser versions over several days before deciding where you set your lowest common denominator for scripted access. Even with IE5, browser detection remains a challenge. As you can see in detail in Chapter 28, the navigator.appVersion property for IE5 for Windows reports version 4 (the same as IE4). You can still sniff for version 5 (you can find the designation MSIE 5 in the navigator.userAgentproperty), but the process is not as straightforward as it could be especially if you need to look for any version greater than or equal to 5. The best advice is to be vigilant when new browsers come on the scene or adopt object detection techniques in your scripts.
We recommend high quality webhost to host and run your jsp application: christian web host services.