What is the difference between Feature Detection and Feature inference

Asked

Viewed 191 times

7

I wanted to know the main difference between the two forms Feature Detection and Feature inference.

1 answer

7


Feature Detection is to verify that the function is available to be used explicitly.

Feature inference consists in checking whether a function is available and, based on this, assuming that another one will also be available.

Feature Detection:

if (window.XMLHttpRequest) {
    new XMLHttpRequest();
}

Feature inference:

if (document.getElementsByTagName){
element = document.getElementById(id);
}

Source: Question SO En

Browser other questions tagged

You are not signed in. Login or sign up in order to post.