title: Browser sniffing
body: <p>I know browsersniffing is not the correct way to design a site for multiple browsers.  My question however is not related to designing a site which behaves well for each browser.</p>
  
  <p>I want to offer the user the ability to install the site as a webapp if the browser is Google Chrome or Firefox 4+, as a widget if it's Opera, as an extension if it's Safari... and so on</p>
  
  <p>Basically I want to slide in a div with a button offering this kind of install.  There is no use showing the webapp solution if the browser is for example Safari as Safari has no support for it.</p>
  
  <p>So how do I do this in a good way?</p>
  
  <p>I found this based on features rather than useragent</p>
  
  <p><a href="https://stackoverflow.com/questions/81099/safe-feature-based-way-for-detecting-google-chrome-with-javascript">Safe feature-based way for detecting Google Chrome with Javascript?</a></p>
  
  <pre><code>var is = {
    ff: window.globalStorage,
    ie: document.all &amp;&amp; !window.opera,
    ie6: !window.XMLHttpRequest,
    ie7: document.all &amp;&amp; window.XMLHttpRequest &amp;&amp; !XDomainRequest &amp;&amp; !window.opera,
    ie8: document.documentMode==8,
    opera: Boolean(window.opera),
    chrome: Boolean(window.chrome),
    safari: window.getComputedStyle &amp;&amp; !window.globalStorage &amp;&amp; !window.opera
  }
  </code></pre>
  
  <p>It seems to work for my needs and is short and not bulky and more or less spoof safe</p>