Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
browser-platform
Advanced tools
This is a naive implementation of browser/platform detection in JavaScript.
It is exported as a CommonJS/Node-style module, the main exports is a function that is meant to be called by passing in the useragent.
// CommonJS/Node Import
var platform = require('browser-platform')(window.navigator.userAgent)
// Direct browser injection
var platform = getBrowserPlatform(window.navigator.userAgent);
document.documentElement.setAttribute('class', ['js'].concat(platform.classNames).join(' '))
When run client-side some features (namely touch) are detected from the environment if not easily determined from the useragent. Android and iOS assume touch.
You can use platform.classes.join(' ')
as CSS classes to be added to the html
element, which can help with platform specific quirks.
The base portable detection portion of the script originated with detectmobilebrowser.com's regular expression(s). The rest was written by me. This library is released under a permissive ISC license. It has been very useful for me, and at 2.3KB minified and gzipped, much smaller than most detection libraries.
FAQs
Naive browser/platform detection
The npm package browser-platform receives a total of 1 weekly downloads. As such, browser-platform popularity was classified as not popular.
We found that browser-platform demonstrated a not healthy version release cadence and project activity because the last version was released 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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.