jQuery jQuery.browser Property

Beginner
⏱️ 10 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
Legacy UA sniff

What You’ll Learn

The removed jQuery.browser object exposed user-agent flags like msie and webkit plus a version string. This tutorial explains what it was, why jQuery removed it in 1.9, how to read legacy plugins, and what to use instead — feature detection with Modernizr and native APIs.

01

Object

$.browser

02

Flags

msie, webkit

03

version

Engine #

04

Removed

Since 1.9

05

UA sniff

Unreliable

06

Modernizr

Use instead

Introduction

In the early jQuery era, Internet Explorer behaved differently from Firefox, Opera, and early WebKit browsers. Many tutorials branched with if ($.browser.msie) to pick CSS fixes or event workarounds. jQuery shipped jQuery.browser so developers could read those flags without writing their own navigator.userAgent parsers.

The object was available immediately when jQuery loaded — even before $(document).ready() — because it only inspected the user-agent string. That convenience came at a cost: browsers lie, spoof, and change their reported identity. Feature tests proved more reliable than guessing from the UA string.

jQuery deprecated jQuery.browser in version 1.3 and removed it in jQuery 1.9. Modern jQuery 3.x projects should not use it. This page teaches the API so you can maintain legacy code and migrate away from user-agent sniffing.

Understanding the jQuery.browser Property

jQuery.browser is a plain object whose properties are Booleans (except version) derived from navigator.userAgent. The documented flags are:

  • msie — Microsoft Internet Explorer
  • mozilla — Mozilla-based browsers (Firefox, etc.)
  • webkit — WebKit-based browsers (since jQuery 1.4)
  • opera — Opera
  • safari — deprecated flag; prefer webkit

jQuery.browser.version (added in jQuery 1.1.3) stores a string with the reported rendering engine version — not always the marketing browser version users recognize.

⚠️
Removed in jQuery 1.9

$.browser does not exist in jQuery 3.7.x unless you include the jQuery Migrate plugin. Try-it labs use jQuery 1.12.4 for authentic historical behavior.

📝 Syntax

Read browser flags and version from the global object:

jQuery
jQuery.browser
// or
$.browser

// Common legacy checks (jQuery < 1.9 or with Migrate)
$.browser.msie
$.browser.webkit
$.browser.version

Return value

  • A plain object with Boolean engine flags and a version string.
  • Available synchronously when jQuery loads — no parameters.

Official inspection pattern

jQuery
jQuery.each( jQuery.browser, function( i, val ) {
  $( "<div>" + i + " : " + val + "</div>" )
    .appendTo( document.body );
});

⚡ Quick Reference

PropertyMeaning (historical)
$.browser.msieInternet Explorer
$.browser.mozillaMozilla / Firefox family
$.browser.webkitWebKit (Chrome, Safari, …)
$.browser.operaOpera
$.browser.safariDeprecated — use webkit
$.browser.versionRendering engine version string

📋 $.browser vs Feature Detection

Sniff the user agent vs test what the browser can actually do.

$.browser
UA string

Removed 1.9

Modernizr
feature tests

Recommended

CSS.supports
native CSS

Modern CSS

$.support
internal

jQuery only

Examples Gallery

Examples follow the official jQuery.browser documentation. Labs use jQuery 1.12.4 (last 1.x with $.browser) unless noted. jQuery 3.x requires Migrate for these patterns.

📚 Getting Started

Official demo — list every property on the browser object.

Example 1 — Official Show Browser Info Demo

Iterate jQuery.browser and append each flag to the page.

jQuery
jQuery.each( jQuery.browser, function( i, val ) {
  $( "<div>" + i + " : " + val + "</div>" )
    .appendTo( document.body );
});
Try It Yourself

How It Works

The official docs use this loop to debug what jQuery detected from navigator.userAgent. Values differ per browser and can mislead — treat output as historical curiosity.

📈 Practical Patterns

Legacy conditionals, version reads, and modern migration.

Example 2 — Official $.browser.msie Check

Return true when the user agent looks like Internet Explorer.

jQuery
if ( $.browser.msie ) {
  // IE-specific workaround (legacy)
  $("div.panel").css("zoom", 1);
}

console.log("Is MSIE?", $.browser.msie);
Try It Yourself

How It Works

This pattern filled countless IE6–8 tutorials. It fails on Edge (Chromium) and any browser spoofing its UA — rewrite with feature tests or drop IE-only branches entirely.

Example 3 — Official WebKit Branch

From the jQuery docs — alert only for WebKit browsers.

jQuery
if ( $.browser.webkit ) {
  console.log("This is WebKit!");
  $("body").addClass("is-webkit");
}
Try It Yourself

How It Works

WebKit flag was true for Chrome, Safari, and many mobile browsers. Today, test the CSS or JS feature you care about — not the engine name in the UA string.

Example 4 — Official $.browser.version Demo

Display the rendering engine version reported by the browser.

jQuery
$("p").html(
  "The version # of the browser's rendering engine is: " +
  $.browser.version
);

if ( $.browser.msie ) {
  console.log("IE engine version:", $.browser.version);
}
Try It Yourself

How It Works

Version strings mapped to engine builds — Firefox reported Gecko version, IE could report 7.0 in Compatibility View while pretending to be IE8. Never gate features on version alone.

Example 5 — Modern Replacement (jQuery 3.7+)

$.browser is undefined in current jQuery — use feature detection instead.

jQuery
// jQuery 3.7.1 — $.browser does not exist
console.log(typeof $.browser); // "undefined"

// Replace UA branches with capability checks
var features = {
  flexbox: window.CSS && CSS.supports("display", "flex"),
  grid: window.CSS && CSS.supports("display", "grid"),
  fetch: typeof fetch === "function"
};

if ( features.flexbox ) {
  $("body").addClass("has-flexbox");
}
Try It Yourself

How It Works

New code should never reintroduce UA sniffing. Test the feature you need — layout, API, input type — and let CSS progressive enhancement handle the rest.

🚀 When You Might Encounter jQuery.browser

  • Legacy jQuery 1.x plugins — IE or WebKit branches in vendor code.
  • Archaeology — understand 2008–2012 tutorials and books.
  • Migration audits — grep for $.browser before upgrading jQuery.
  • jQuery Migrate — temporary restoration while refactoring sniffing out.
  • Not for new features — use Modernizr or native detection.
  • Pair with support docs — feature flags vs UA names (jQuery.support).

🧠 How jQuery.browser Parsed User Agents

1

jQuery loads

Reads navigator.userAgent synchronously.

UA
2

Set flags

Populates msie, mozilla, webkit, opera, version.

Parse
3

App branches

Legacy code picks CSS/JS paths from flags — fragile today.

If/else
4

Migrate away

Replace with feature tests — jQuery removed this in 1.9.

📝 Notes

  • Added jQuery 1.0; deprecated 1.3; removed jQuery 1.9.
  • webkit flag added jQuery 1.4; safari flag deprecated.
  • jQuery.browser.version added jQuery 1.1.3 — engine version, not always browser marketing version.
  • Vulnerable to UA spoofing and compatibility-mode lies (IE8 reporting as 7).
  • Restore temporarily via jQuery Migrate when upgrading old sites — then remove branches.
  • Related: jQuery.support, Modernizr, CSS.supports().

Browser Support

jQuery.browser existed in jQuery 1.0 through 1.8.x and was removed in jQuery 1.9. It is not in jQuery 2.x or 3.x unless jQuery Migrate is loaded.

Removed 1.9

jQuery jQuery.browser

Historical API only. jQuery 1.12.4 Try-it labs demonstrate original behavior. jQuery 3.7+ has no $.browser — use feature detection.

N/A Removed API
Google Chrome All versions · Desktop & Mobile
Full support
Mozilla Firefox All versions · Desktop & Mobile
Full support
Apple Safari All versions · macOS & iOS
Full support
Microsoft Edge All versions · Chromium & Legacy
Full support
Internet Explorer IE 6+ · Legacy environments
Full support
Opera All modern versions
Full support
jQuery 3.x Not included

Bottom line: Do not depend on $.browser in new code. Use Modernizr, CSS.supports(), or explicit in-window checks for capabilities.

Conclusion

jQuery.browser was jQuery’s user-agent sniffing object — convenient in 2008, unreliable long term. Flags like msie and webkit plus the version string helped old plugins survive the browser wars, but they break when UAs change.

jQuery removed the API in 1.9 and pointed developers toward feature detection. Learn it to read legacy code; write new conditionals with Modernizr, native tests, and progressive enhancement instead.

💡 Best Practices

✅ Do

  • Detect features with Modernizr or CSS.supports()
  • Grep for $.browser when upgrading jQuery 1.x sites
  • Use jQuery Migrate briefly while rewriting UA branches
  • Test behavior in real browsers, not UA strings
  • Prefer progressive enhancement over browser-specific CSS

❌ Don’t

  • Add new if ($.browser.msie) checks in 2026 code
  • Trust $.browser.version for feature gating
  • Assume Migrate is a permanent fix — plan removal
  • Confuse WebKit flag with “only Safari”
  • Sniff UA when a one-line feature test suffices

Key Takeaways

Knowledge Unlocked

Five things to remember about jQuery.browser

Removed user-agent sniffing — know it, don’t use it.

5
Core concepts
msie 02

Flags

4 engines

Props
# 03

version

Engine

String
1.9 04

Removed

No 3.x

History
M 05

Features

Not UA

Modern

❓ Frequently Asked Questions

jQuery.browser was a plain object on the jQuery namespace that exposed Boolean flags parsed from navigator.userAgent — msie, mozilla, webkit, opera, and the deprecated safari flag. jQuery.browser.version held the rendering engine version string. Added in jQuery 1.0.
No in jQuery 1.9+. The property was deprecated in jQuery 1.3 and removed entirely in jQuery 1.9. jQuery 3.7.x does not include $.browser unless you load the jQuery Migrate plugin, which restores it for legacy code with console warnings.
User-agent sniffing is unreliable — browsers spoof strings, version tokens lie (IE compatibility view), and new browsers break if/else chains. jQuery removed $.browser in 1.9 and recommends feature detection with Modernizr or native capability tests instead.
jQuery.browser.version is a string reporting the rendering engine version from the user agent — for example Gecko version for Firefox or Trident/MSIE version for Internet Explorer. It was removed with jQuery.browser in 1.9 and suffers the same spoofing problems as the flags.
jQuery.browser parsed navigator.userAgent to guess browser name and version. jQuery.support ran feature tests for DOM/CSS bugs. Both were deprecated for external use in the jQuery 1.9 era — browser was removed; support remains internal only in jQuery 3.x.
Detect features, not browser names: CSS.supports() for CSS, 'fetch' in window for APIs, Modernizr for broad HTML/CSS classes on html, and progressive enhancement. When maintaining old plugins, use jQuery Migrate temporarily while rewriting conditionals to feature tests.
Did you know?

Because jQuery.browser was available before DOM ready, some old bootstraps checked $.browser inline in the <head> to decide whether to call $(document).ready() at all. That pattern is obsolete — jQuery’s ready helpers always handle late binding today. The jQuery 1.9 removal pushed the entire ecosystem toward the same lesson Mozilla and Google had been preaching for years: detect features, don’t detect browsers.

Next: jQuery.error() Method

Throw exceptions from a string and override the hook for plugin logging.

jQuery.error() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

6 people found this page helpful