Created
August 7, 2012 13:05
-
-
Save barneycarroll/3285152 to your computer and use it in GitHub Desktop.
Browser feature inference
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
browser = { | |
ieVersion: function () { | |
var undef; | |
var v = 3; | |
var div = document.createElement('div'); | |
var all = div.getElementsByTagName('i'); | |
while ( | |
div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->', all[0]); | |
return v > 4 ? v : undef; | |
}, | |
hasFlash: function () { | |
try { | |
return new ActiveXObject('ShockwaveFlash.ShockwaveFlash') ? true : false; | |
} catch (e) { | |
return navigator.mimeTypes["application/x-shockwave-flash"] !== undefined ? true : false; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment