Skip to content

Instantly share code, notes, and snippets.

@yckart
Created January 31, 2013 15:48
Show Gist options
  • Save yckart/4683843 to your computer and use it in GitHub Desktop.
Save yckart/4683843 to your computer and use it in GitHub Desktop.
var getPrefix = (function(browser) { // Closure for putting result in cache
var prefixes = {firefox:'moz', applewebkit:'webkit', webkit:'webkit', opera:'o', msie:'ms'};
for (var p in prefixes)
if (browser.indexOf(p) !== -1) return prefixes[p];
return false;
})(navigator.userAgent.toLowerCase());
// console.log(getPrefix);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment