Last active
August 29, 2015 14:20
-
-
Save jasdeepkhalsa/eee504e41d817490833e to your computer and use it in GitHub Desktop.
Cutting the Mustard Feature Detection
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: http://responsivenews.co.uk/post/18948466399/cutting-the-mustard | |
if('querySelector' in document && 'localStorage' in window && 'addEventListener' in window) { | |
// Load the enhanced app: | |
/* | |
HTML5 browsers:- | |
IE9+ | |
Firefox 3.5+ | |
Opera 9+ (and probably further back) | |
Safari 4+ | |
Chrome 1+ (I think) | |
iPhone and iPad iOS1+ | |
Android phone and tablets 2.1+ | |
Blackberry OS6+ | |
Windows 7.5+ (new Mango version) | |
Mobile Firefox (all the versions we tested) | |
Opera Mobile (all the versions we tested) | |
*/ | |
} | |
else { | |
// Load the basic app: | |
/* | |
HTML4 browsers:- | |
IE8- | |
Blackberry OS5- | |
Nokia S60 v6- | |
Nokia S40 (all versions) | |
All other Symbian variants | |
Windows 7 phone (pre-Mango) | |
…and many more that are too numerous to mention | |
*/ | |
} |
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: https://justmarkup.com/log/2015/02/26/cut-the-mustard-revisited/ | |
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