Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * - browser detection is based on user agent parsing
- * - feature/object detection should be prefered whereever it's possible.
- */
- var UA = (function() {
- var match = navigator.userAgent.toLowerCase().match(/(opera|msie|firefox|chrome|safari)[\s\/]([^\s]*)/),
- name = { msie: 'ie', firefox: 'ff'}[match[1]] || match[1],
- version = parseFloat(match[2]),
- platform = (navigator.platform.toLowerCase().match(/mac|win|linux/) || ['other'])[0],
- UA = { name: name, platform: platform };
- UA[name] = version;
- UA[platform] = true;
- UA.webkit = !!(UA.safari || UA.chrome);
- return UA;
- })();
Add Comment
Please, Sign In to add comment