ulvis.paste.net

Paste Search Dynamic
Recent pastes
browser info js
  1. <script src="https://kylemit.github.io/libraries/libraries/BrowserDetect.js"></script>
  2. <script>
  3.  
  4. By using our site, you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service.
  5.  
  6.  
  7. /**
  8.  * Gets the browser name or returns an empty string if unknown.
  9.  * This function also caches the result to provide for any
  10.  * future calls this function has.
  11.  *
  12.  * @returns {string}
  13.  */
  14. var browser = function() {
  15.     // Return cached result if avalible, else get result then cache it.
  16.     if (browser.prototype._cachedResult)
  17.         return browser.prototype._cachedResult;
  18.  
  19.     // Opera 8.0+
  20.     var isOpera = (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
  21.  
  22.     // Firefox 1.0+
  23.     var isFirefox = typeof InstallTrigger !== 'undefined';
  24.  
  25.     // Safari 3.0+ "[object HTMLElementConstructor]"
  26.     var isSafari = /constructor/i.test(window.HTMLElement) || (function (p) { return p.toString() === "[object SafariRemoteNotification]"; })(!window['safari'] || safari.pushNotification);
  27.  
  28.     // Internet Explorer 6-11
  29.     var isIE = /*@[email protected]*/false || !!document.documentMode;
  30.  
  31.     // Edge 20+
  32.     var isEdge = !isIE && !!window.StyleMedia;
  33.  
  34.     // Chrome 1+
  35.     var isChrome = !!window.chrome && !!window.chrome.webstore;
  36.  
  37.     // Blink engine detection
  38.     var isBlink = (isChrome || isOpera) && !!window.CSS;
  39.  
  40.     return browser.prototype._cachedResult =
  41.         isOpera ? 'Opera' :
  42.         isFirefox ? 'Firefox' :
  43.         isSafari ? 'Safari' :
  44.         isChrome ? 'Chrome' :
  45.         isIE ? 'IE' :
  46.         isEdge ? 'Edge' :
  47.         isBlink ? 'Blink' :
  48.         "Don't know";
  49. };
  50.  
  51. console.log(browser());
  52.  
  53. </script>
Parsed in 0.015 seconds