Guest User

Untitled

a guest
Jul 21st, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. /*
  2. * - browser detection is based on user agent parsing
  3. * - feature/object detection should be prefered whereever it's possible.
  4. */
  5. var UA = (function() {
  6.  
  7. var match = navigator.userAgent.toLowerCase().match(/(opera|msie|firefox|chrome|safari)[\s\/]([^\s]*)/),
  8. name = { msie: 'ie', firefox: 'ff'}[match[1]] || match[1],
  9. version = parseFloat(match[2]),
  10. platform = (navigator.platform.toLowerCase().match(/mac|win|linux/) || ['other'])[0],
  11. UA = { name: name, platform: platform };
  12.  
  13. UA[name] = version;
  14. UA[platform] = true;
  15. UA.webkit = !!(UA.safari || UA.chrome);
  16.  
  17. return UA;
  18.  
  19. })();
Add Comment
Please, Sign In to add comment