Comments (5)
Agreed. We use _detect
within a wrapper so that we can run our tests in node. But we'd also like to use bowser full-force in node.
Would a PR be accepted that changes the api to accept a UA string and only defaults to using the navigator
?
from bowser.
Sorry, guys, but I haven't got what you want to do with the API. Could you give me more details?
from bowser.
Personally, I would love to see something like how substack's cookie-cutter handles it's document.cookie.
https://github.com/substack/cookie-cutter/blob/master/index.js#L1-L4
The module exports a function that, if given a string uses the string as document.cookie
. If given an object, it treats the object as document
(and thus expects it to have a cookie
property; defaulting cookie
to ""
if it doesn't). If it's given a falsey value (undefined
being the only falsey value we really care about), it defaults to checking the global document
. If global document doesn't exist, it falls back to {cookie:""}
as the document
.
For bowser, I would expect to see:
browser = require('bowser');
// defaults to document.navigator
browser()
// uses provided document.navigator object
browser({navigator: { userAgent: "foo"} })
// uses provided string as the ua string
browser("Mozilla/5.0 (Linux; Android 5.1.1; Nexus 9 Build/LMY48T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.83 Safari/537.36")
from bowser.
Interesting point. I think this is a good issue for the next major release 👍 It would be nice if you want to help with it by PR. If you do, please, checkout develop
branch and send the PR.
from bowser.
API of the new version will be much better. The release is very soon. You can track activity in the branch named v2
.
from bowser.
Related Issues (20)
- macOS Monterey 12 detected as Catalina
- Reporting Missing Browsers
- Requesting New Feature for OS parser
- Safari iOS 15.1 and iOS 15.2 Beta version no longer detected in WKWebView HOT 1
- Copyright not included in bundled.js
- Composable architecture
- Quick question: how dose this detect?
- Detecting Windows 11 as Windows 10 NT
- ipad still wrong
- Tree shaking causes error with Vite
- Bowser crashes in Next.js Middleware Functions HOT 1
- Parsing the version number throws an error if it contains letters
- Mobile platform browsers overwriting desktop platform browsers HOT 1
- Wrong browser version detected (Chrome - MacOS) HOT 1
- Will a new official version be released HOT 2
- Frowser - Bowser forked HOT 1
- Handling of non-Linux Unix derivates? HOT 1
- FR: Add a parser for CPU architecture detection
- Firefox iPad is being detected as Safari HOT 4
- Typescript file should have union of string literal types, not just generic `string` types HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bowser.