title: Detect Desktop Browser (not mobile) with Javascript
body: <p>I found the following code to detect a desktop browser. But the method also detects some mobile browsers. How can I detect only desktop browsers like Safari, IE, Firefox, Opera etc?</p>
  
  <pre><code>is_desktopBrowser : function() {
      var ua = navigator.userAgent.toLowerCase();
  
      var rwebkit = /(webkit)[ \/]([\w.]+)/;
      var ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/;
      var rmsie = /(msie) ([\w.]+)/;
      var rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/;
  
      var match = rwebkit.exec(ua) ||
              ropera.exec(ua) ||
              rmsie.exec(ua) ||
              ua.indexOf("compatible") &lt; 0 &amp;&amp; rmozilla.exec(ua) ||
              [];
  
      return { browser: match[1] || "", version: match[2] || "0" };
  },
  </code></pre>