Last active
July 4, 2018 06:14
-
-
Save johanbove/9570df0ee85bbb3a630a to your computer and use it in GitHub Desktop.
Cutting the mustard
This file contains 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
// From Christian Heillman | |
// http://www.slideshare.net/cheilmann/jsday-48092671 | |
// http://justmarkup.com/log/2015/02/26/cut-the-mustard-revisited/ | |
if ('querySelector' in document && | |
'localStorage' in window && | |
'addEventListener' in window) { | |
// Modern browser. Let's add JavaScript functionality | |
} |
This file contains 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
// Jake Archibald | |
// A nice way to prevent your JS running in IE<10 and Android Webkit | |
// http://caniuse.com/#feat=pagevisibility | |
if (!('visibilityState' in document)) { | |
return; | |
} |
This file contains 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
// extending the baseline | |
// Christian Heilmann | |
if ('visibilityState' in document) { | |
// Modern browser. Let's load JavaScript | |
if ('serviceWorker' in navigator) { | |
// Let's add offline support | |
navigator.serviceworker.register('sw.js', { | |
scope: './' | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment