Last active
April 13, 2016 14:02
-
-
Save AllThingsSmitty/fd2b021d46b2c9fb2d32 to your computer and use it in GitHub Desktop.
Revised cut-the-mustard browser feature detection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Streamlined CTM method using Page Visibility API (http://caniuse.com/#feat=pagevisibility) | |
if ('visibilityState' in document) { | |
// Modern browser, add JS functionality | |
} | |
// Previous CTM method based on which DOM features are present | |
if('querySelector' in document | |
&& 'localStorage' in window | |
&& 'addEventListener' in window) { | |
// Modern browser, add JS functionality | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment