Guest User

Untitled

a guest
Jun 23rd, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. // Opera 8.0+
  2. var isOpera = (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
  3.  
  4. // Firefox 1.0+
  5. var isFirefox = typeof InstallTrigger !== 'undefined';
  6.  
  7. // Safari 3.0+ "[object HTMLElementConstructor]"
  8. var isSafari = /constructor/i.test(window.HTMLElement) || (function (p) { return p.toString() === "[object SafariRemoteNotification]"; })(!window['safari'] || safari.pushNotification);
  9.  
  10. // Internet Explorer 6-11
  11. var isIE = /*@cc_on!@*/false || !!document.documentMode;
  12.  
  13. // Edge 20+
  14. var isEdge = !isIE && !!window.StyleMedia;
  15.  
  16. // Chrome 1+
  17. var isChrome = !!window.chrome && !!window.chrome.webstore;
  18.  
  19. // Blink engine detection
  20. var isBlink = (isChrome || isOpera) && !!window.CSS;
  21.  
  22. var output = 'Detecting browsers by ducktyping:<hr>';
  23. output += 'isFirefox: ' + isFirefox + '<br>';
  24. output += 'isChrome: ' + isChrome + '<br>';
  25. output += 'isSafari: ' + isSafari + '<br>';
  26. output += 'isOpera: ' + isOpera + '<br>';
  27. output += 'isIE: ' + isIE + '<br>';
  28. output += 'isEdge: ' + isEdge + '<br>';
  29. output += 'isBlink: ' + isBlink + '<br>';
Add Comment
Please, Sign In to add comment