Skip to content

Instantly share code, notes, and snippets.

@thealscott
Last active December 17, 2015 07:39
Show Gist options
  • Save thealscott/ebadb841e8f5be4645c0 to your computer and use it in GitHub Desktop.
Save thealscott/ebadb841e8f5be4645c0 to your computer and use it in GitHub Desktop.
Some ghetto UA based feature blacklisting, supplement for Modernizr (for shit that it can't reliably feature detect)
var userAgentNaughtyList = {
positionFixed : [
'Android 2',
'Android 3',
'Android 4.0',
'iPhone OS 4',
'iPhone OS 5',
'Windows Phone OS 7'
],
vimeo : [
'Android 2',
'Android 3',
/Android 4\.0.*.Version\/4.*.Mobile Safari/, //android 4.0 but only using native browser
'Windows Phone OS 7',
'Windows Phone 8'
],
displayTable : [
'Windows Phone OS 7',
'Windows Phone 8'
],
animateScrollTop : [
'Windows Phone 8'
],
fixedScrollTop : [
'OS X 10_7_1'
]
}
$.each(userAgentNaughtyList, function(key, value){
window[key] = true;
$.each(value, function(index, subvalue){
if (navigator.userAgent.match(subvalue)) {
window[key] = false;
}
});
$('html').addClass(String(key) + '-' + String(window[key]));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment