title: What is the correct way to detect Opera using jQuery?
body: <p>Amazon.com recently updated their javascript, and it's causing problems with some Opera browsers.</p>
  
  <p>Their browser detection code looks like so, but it's faulty:</p>
  
  <pre><code>    function sitbReaderIsCompatibleBrowser() {
          if (typeof(jQuery) == 'undefined') {
              return false;
          } else {
              var version = jQuery.browser.version || "0";
              var splitVersion = version.split('.');
              return (
                     (jQuery.browser.msie &amp;&amp; splitVersion[0] &gt;= 6)  // IE 6 and higher
                  || (jQuery.browser.mozilla &amp;&amp; (
                         (splitVersion[0] == 1 &amp;&amp; splitVersion[1] &gt;= 8) // Firefox 2 and higher
                      || (splitVersion[0] &gt;= 2)
                     ))
                  || (jQuery.browser.safari &amp;&amp; splitVersion[0] &gt;= 500) // Safari 5 and higher
                  || (jQuery.browser.opera &amp;&amp; splitVersion[0] &gt;= 9) // Opera 5 and higher
              );
          }
  }
  </code></pre>
  
  <p>Nothing <em>obviously</em> wrong jumps out at me with this code, but I've never used jQuery before so I don't know.</p>
  
  <p>Even though this code looks like it's attempting to let Opera users through, when I visit the page with Opera 9.64 I get an "unsupported browser" message. If I change Opera's settings to report itself as Firefox, the page works perfectly! With that in mind, I'm pretty sure it's a problem with the script and not the browser.</p>
  
  <p>Any jQuery experts have a suggestion?</p>
  
  <p>You can replicate the behavior by visiting any book on Amazon and clicking the "look inside this book" link. </p>