Created
December 19, 2013 15:18
-
-
Save ryanburnett/8040771 to your computer and use it in GitHub Desktop.
conditionizr
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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>conditionizr</title> | |
<script src="scripts/conditionizr.js"></script> | |
<script> | |
// Chrome | |
conditionizr.add('chrome', ['class'], function () { | |
return !!window.chrome && /google/i.test(navigator.vendor); | |
}); | |
// Firefox | |
conditionizr.add('firefox', ['class'], function () { | |
return typeof InstallTrigger !== 'undefined'; | |
}); | |
// IE 10 | |
conditionizr.add('ie10', ['class'], function () { | |
var version = false; | |
/*@cc_on | |
if (/^10/.test(@_jscript_version) && /MSIE 10\.0(?!.*IEMobile)/i.test(navigator.userAgent)) | |
version = true | |
@*/ | |
return version; | |
}); | |
// IE 11 | |
conditionizr.add('ie11', ['class'], function () { | |
return /(?:\sTrident\/7\.0;.*\srv:11\.0)/i.test(navigator.userAgent); | |
}); | |
// Safari | |
conditionizr.add('safari', ['class'], function () { | |
return /constructor/i.test(window.HTMLElement); | |
}); | |
// iOS | |
conditionizr.add('ios', ['class'], function () { | |
return /(iPad|iPhone|iPod)/i.test(navigator.userAgent); | |
}); | |
</script> | |
</head> | |
<body> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment