Feature Detection

Feature detection is a method for testing the existence of a specific feature. If you use browser detection routines, you not only have to include a check for all browser names and versions that support your feature, but you might have to update this code every time a new browser is released.
But by using feature detection, it doesn't matter when new browsers are released-your code will still work. Let's do an example.
if (document.all)
{
// Use document.all
}
document.all was an Internet Explorer only property many years ago. In the above, we check to see if the property exists on the document object. The expression is true if the property exists, and false if it doesn't.







No comments :
Post a Comment