Third, there are new browsers coming onto the market all of the time and each new browser version supports new features that the prior version didn't support or supported in a different way. To keep up, you would be constantly updating your code.
So what's the solution? The solution is feature sensing.
With feature sensing, instead of checking what browser our visitor is supposedly running and then relying on our knowledge of what that browser does and doesn't support, we test the feature that we intend to use directly to see if it is supported. Testing if a feature is or isn't supported is a much more effective way of coding the decision on whether or not to run the code that requires that feature in order to work.
There are a number of DOM values that can be simply tested like this to determine which features the browser being used supports so that you can present your visitor with additional functionality on those browsers that support those functions while hiding the very existence of the feature if the browser can't understand. Here are some examples of values to test for support of certain features:
This article written by Stephen Chapman, Felgall Pty Ltd.