<pclass="desc"><strong>Description: </strong>We recommend against using this property, please try to use feature detection instead (see jQuery.support). Contains flags for the useragent, read from navigator.userAgent. While jQuery.browser will not be removed from future versions of jQuery, every effort to use jQuery.support and proper feature detection should be made.</p>
<p>The <code>$.browser</code> property allows us to detect which web browser is accessing the page, as reported by the browser itself. It contains flags for each of the four most prevalent browser classes (Internet Explorer, Mozilla, Webkit, and Opera) as well as version information.</p>
<p>Available flags are:</p>
<ul>
<li>webkit (as of jQuery 1.4)</li>
<li>safari (deprecated)</li>
<li>opera</li>
<li>msie</li>
<li>mozilla</li>
</ul>
<p>This property is available immediately. It is therefore safe to use it to determine whether or not to call <code>$(document).ready()</code>.
The <code>$.browser</code> property is deprecated in jQuery 1.3, but there are no immediate plans to remove it.</p>
<p>Because <code>$.browser</code> uses <code>navigator.userAgent</code> to determine the platform, it is vulnerable to spoofing by the user or misrepresentation by the browser itself. It is always best to avoid browser-specific code entirely where possible. The <code>$.support</code> property is available for detection of support for particular features rather than relying on <code>$.browser</code>.</p>
</div>
<h3>Examples:</h3>
<divid="entry-examples"class="entry-examples">
<divid="example-0">
<h4>Example: <spanclass="desc">Show the browser info.</span>
$("p").html("The browser version is: <span>" +
jQuery.browser.version + "</span>");
</script>
</body>
</html></code></pre>
<h4>Demo:</h4>
<divclass="demo code-demo"></div>
</div>
<divid="example-1">
<h4>Example: <spanclass="desc">Alerts the version of IE that is being used</span>
</h4>
<pre><codeclass="example">if ( $.browser.msie ) {
alert( $.browser.version );
}</code></pre>
</div>
<divid="example-2">
<h4>Example: <spanclass="desc">Often you only care about the "major number," the whole number. This can be accomplished with JavaScript's built-in parseInt() function:</span>