Electric Type

Multimedia

About Us

News

Help

Advanced JavaScript Tutorial
Lesson 3

by Thau!

Page 7 — Browser Detection

Almost everything I've covered so far works on all JavaScript-enabled browsers. However, there are some things that just don't fly on certain browsers. MSIE 3.0, for one, doesn't support image swapping. So if you have a page that depends on image swapping to function correctly, either you nix the image swapping altogether, or you furnish MSIE 3.0 visitors with information tailor-made for their browser.

There are a few approaches to dealing with browsers with different capabilities. The most straightforward method is to determine what browser someone is using and then serve up the appropriate browser-specific information.

There are several ways to do this. Some sites ask you to choose which browser you're using right up front; e.g., "Click here if you're using Netscape." But this isn't an ideal solution for a number of reasons. For one thing, it's a hassle for the user (and, with impatient users, that extra click may mean the difference between staying or backing out). It also means that you have to maintain duplicate (or maybe even more) versions of the same pages.

An alternative is to use JavaScript to figure out what browser someone is using, and automatically route the visitor to a set of pages that works for that browser. Unfortunately, this still forces you to maintain two or more versions of each page, which is really a drag.

A much better solution is to make your pages smart enough to look one way to some browsers and another way to other browsers (which is what we'll concentrate on for the rest of today's lesson).

next page»


Tutorials  

User Blogs  

Teaching Tools  

Authoring  

Design  

Programming help  

Advanced Flash  

Javascript  

Glossary  

PHP Coding  

User Blogs

Screen Shots

Latest Updates

Contact Us

Valid HTML 4.01!
Valid CSS!

Breadcrumb

© ElectricType
Maintained by My-Hosts.com
Site map | Copyright | Disclaimer
Privacy policy | Acceptable Use Policy
Legal information.