
Security News
New React Server Components Vulnerabilities: DoS and Source Code Exposure
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.
@melloware/jquery.browser
Advanced tools
A jQuery plugin for browser detection. jQuery v1.9.1 dropped support for browser detection, and this project aims to keep the detection up-to-date. Now written in TypeScript with full type definitions and modern browser support including MS Edge.
npm install @melloware/jquery.browser
Include script after the jQuery library:
<script src="/path/to/jquery.browser.js"></script>
Alternatively, you can use the plugin without jQuery by using the global object jQBrowser instead of $.browser.
Returns true if the current useragent is some version of Microsoft's Edge browser. Supports both legacy and Chromium based edge)
$.browser.msedge;
Returns true if the current useragent is some version of a WebKit browser (Safari, Chrome, Opera 15+, and Chromium Edge)
$.browser.webkit;
Returns true if the current useragent is some version of Firefox
$.browser.mozilla;
Reading the browser version
$.browser.version
You can also examine arbitrary useragents
jQBrowser.uaMatch("Mozilla/5.0...");
The plugin includes full TypeScript type definitions:
import { BrowserDetection, uaMatch } from '@melloware/jquery.browser';
// Use with jQuery
if ($.browser.chrome) {
console.log(`Chrome version: ${$.browser.version}`);
}
// Use standalone
const browser = window.jQBrowser;
if (browser.msedge) {
console.log('Microsoft Edge detected');
}
// Match arbitrary user agent
const detection = uaMatch("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36...");
console.log(detection.name); // "msedge"
The plugin detects the following browsers:
Detect specifically Windows, Mac, Linux, iPad, iPhone, iPod, Android, Kindle, BlackBerry, Chrome OS, and Windows Phone useragents:
$.browser.android
$.browser.blackberry
$.browser.cros
$.browser.ipad
$.browser.iphone
$.browser.ipod
$.browser.kindle
$.browser.linux
$.browser.mac
$.browser.msedge
$.browser.playbook
$.browser.silk
$.browser.win
$.browser["windows phone"]
Alternatively, you can detect for generic classifications such as desktop or mobile:
$.browser.desktop
$.browser.mobile
// User Agent for Firefox on Windows
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0
$.browser.desktop // Returns true as a boolean
// User Agent for Safari on iPhone
User-Agent: Mozilla/5.0(iPhone; CPU iPhone OS 7_0_3 like Mac OS X; en-us) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11B508 Safari/9537.53
$.browser.mobile // Returns true as a boolean
Detect the browser's major version:
// User Agent for Chrome
// Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1664.3 Safari/537.36
$.browser.versionNumber // Returns 32 as a number
$.browser.version // Returns "32.0.1664.3" as a string
Install dependencies:
npm install
Build the project:
npm run build
This will:
.d.ts files)The build outputs are placed in the dist/ directory:
dist/jquery.browser.js - Main bundle (IIFE format)dist/jquery.browser.min.js - Minified bundledist/jquery.browser.d.ts - TypeScript type definitionsdist/jquery.browser.d.ts.map - Source map for typesRun TypeScript type checking without emitting files:
npm run type-check
The plugin uses Vitest for testing. All tests run in a Node.js environment with jsdom for browser API simulation.
# Run tests once
npm test
# Run tests in watch mode
npm run test:watch
# Run tests with UI
npm run test:ui
The test suite covers:
├── src/
│ └── jquery.browser.ts # TypeScript source
├── dist/
│ ├── jquery.browser.js # Compiled IIFE bundle
│ ├── jquery.browser.min.js # Minified bundle
│ ├── jquery.browser.d.ts # Type definitions
│ └── jquery.browser.d.ts.map # Type definition source map
├── test/
│ ├── jquery.browser.test.ts # Vitest test suite
│ └── setup.ts # Test setup
├── tsconfig.json # TypeScript configuration
├── vitest.config.ts # Vitest configuration
├── package.json
└── README.md
Before publishing, ensure:
Build the project:
npm run build
Run tests:
npm test
Verify package contents:
npm pack --dry-run
This shows what files will be included in the published package.
Check version number:
package.json if neededLogin to npm:
npm login
Make sure you're logged in with an account that has access to the @melloware scope.
Verify you're logged in:
npm whoami
Build the package:
npm run build
Publish the package:
For scoped packages, you need to publish with public access:
npm publish --access public
Or configure the scope in your .npmrc file:
echo "@melloware:registry=https://registry.npmjs.org/" >> .npmrc
echo "//registry.npmjs.org/:_authToken=YOUR_TOKEN" >> .npmrc
Then publish normally:
npm publish
Verify publication: Visit https://www.npmjs.com/package/@melloware/jquery.browser to confirm the package is published.
Follow Semantic Versioning:
Update version in package.json:
{
"version": "1.0.1" // or "1.1.0" or "2.0.0"
}
Then rebuild and republish:
npm run build
npm publish --access public
The plugin supports detection for:
MIT
FAQs
A jQuery plugin for browser detection.
We found that @melloware/jquery.browser demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.

Security News
GitHub has revoked npm classic tokens for publishing; maintainers must migrate, but OpenJS warns OIDC trusted publishing still has risky gaps for critical projects.