Check whether a certain method or property (typically an entry point into using the API or other feature you are detecting for) exists in its parent Object
Check if a certain property exists on a global object (such as window or navigator)
if("geolocation" in navigator) { ... }
Create an element, then check if a certain property exists on that element.
Create an element in memory using Document.createElement() and then check if a property exists on it. The example shown is a way of detecting HTML5 Canvas support
function supports_canvas() {
return !!document.createElement('canvas').getContext;
}
if(supports_canvas()) { ... }
Create an element in memory using Document.createElement()
and then check if
a method exists on it. If it does, check what value it returns
Create an element, check if a certain method exists on that element, then call the method and check the value it returns
Create an element in memory using Document.createElement()
,
set a property to a certain value, then check to see if the value is retained
Create an element, set a property to a certain value, then check if the property has retained its value.