Skip to content

Instantly share code, notes, and snippets.

@AllThingsSmitty
Last active August 29, 2015 14:17
Show Gist options
  • Save AllThingsSmitty/4ee72642c88c11695ec6 to your computer and use it in GitHub Desktop.
Save AllThingsSmitty/4ee72642c88c11695ec6 to your computer and use it in GitHub Desktop.
Feature detection for proxy browsers that lie about their capabilities
// localStorage example
var hasStorage = (function () {
try {
localStorage.setItem(mod, mod);
localStorage.removeItem(mod);
return true;
} catch (exception) {
return false;
}
}());
// Streamlined cut-the-mustard method using Page Visibility API (http://caniuse.com/#feat=pagevisibility)
if ('visibilityState' in document) {
// Modern browser, add JS functionality
}
@AllThingsSmitty
Copy link
Author

Additional context about this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment