7.3. Detection
7.3.1. Browser detection
In many cases, it is important for Web designers to ensure that the right design goes to the right browsers. There are a number of ways to detect different browser software. For example, we have used IE’s document.all feature in Chapter 6 to distinguish between IE and NS browsers. One easy practical statement
var IE = document.all?true:false
can do the trick. However, this statement contains no information about the identity of the browser or its version. For proper identity detection, you need to use the properties of the navigator object inside the browser. Consider the following example ex07-06.htm:
Example. ex07–06.htm – Browser Detection
1: <?xml version="1.0" encoding="iso-8859–1"?> 2: <!DOCTYPE ... |
Get Practical Web Technologies now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.