HTML and CSS Reference
In-Depth Information
an HTML table and how it is represented as a tree where each element is related to its
parent and siblings as described by the W3C shown at http://www.w3.org/DOM.
1.10 What Browser?
When a user receives a page that includes JavaScript, the script is sent to the JavaScript
interpreter, which executes the script. Because each browser has its own interpreter,
there are often differences in how the code will be executed. And as the competing com-
panies improve and modify their browsers, new inconsistencies may occur. There are
not only different types of browsers to cause the incompatibilities but also different ver-
sions of the same browser. Because modern browsers conform to the W3C standards,
these inconsistencies tend to be less of a distraction than they were in the past. Popular
browsers today are shown in Table 1.2.
Table 1.2 Modern Browsers
Browser
Web Site
Internet Explorer
microsoft.com/windows/ie
Firefox
mozilla.org/products/firefox
Safari
apple.com/safari
Opera
opera.com
Google Chrome
google.com/chrome
Konqueror
konqueror.org/
The little script in Example 1.3 should tell you what browser you are using. Even
though the application name might display Netscape for Firefox and Microsoft Internet
Explorer for Opera, if you examine the user agent, you will be able find Firefox or Opera
as part of the output string (see Figure 1.9). Programs that determine the browser type
are called browser sniffers. We have a complete example in Chapter 10, “It's the BOM!
Browser Objects.”
EXAMPLE 1.3
<script type="text/javascript">
alert("User appName is "+ navigator.appName +
"\nUser agent is "+ navigator.userAgent );
</script>
 
 
Search WWH ::




Custom Search