
Research
Security News
Malicious npm Packages Use Telegram to Exfiltrate BullX Credentials
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
browser-locale
Advanced tools
get the user's selected language locale from the navigator object from client-side js
normalizes weird cross browser issues and tries to return the users selected language in 100% client side JS by looking at various properties on the window.navigator
object
note that another technique used to detect the browsers user-set language preference is to look at the accept-language
header set on outgoing http requests, but this requires making a round trip XHR to a server, which is what jquery-browser-language does.
however, it seems that as of 2014 you can get the user specified language without making a HTTP request (see index.js
for details)
npm install browser-locale
use browserify or browserify-cdn to package it for browser use
var locale = require('browser-locale')()
// locale will be e.g. en-US or undefined if it could not be detected (e.g. you are in a super weird browser)
Not all browsers are consistent in their capitalization of language tags,
e.g. en-US
vs en-us
. Keep this in mind when looking for matches in locale
strings.
See also locale2, an alternative module for detecting a user's locale.
FAQs
get the user's selected language locale from the navigator object from client-side js
The npm package browser-locale receives a total of 3,878 weekly downloads. As such, browser-locale popularity was classified as popular.
We found that browser-locale demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.
Security News
AI-generated slop reports are making bug bounty triage harder, wasting maintainer time, and straining trust in vulnerability disclosure programs.