Slide 69
Slide 69 text
Very, very simple JavaScript API support
testing
function isAPISupported(api, source){
//return (api in source) or..
return !!source[api];
};
// testing with google chrome
isAPISupported('geolocation', navigator); // true
isAPISupported('pushState', history); // true
isAPISupported('localStorage', window); // true
isAPISupported('sessionStorage', window); // true
Note: If a third-party library is extending host
objects, 'a' in b or b.a testing may provide
unreliable results. Keep in mind other scripts on
Simple CSS property support testing