Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User-Agent string contains undefined in browserified build #2294

Closed
Zirro opened this issue Jul 13, 2018 · 2 comments
Closed

User-Agent string contains undefined in browserified build #2294

Zirro opened this issue Jul 13, 2018 · 2 comments

Comments

@Zirro
Copy link
Member

Zirro commented Jul 13, 2018

The default user agent string for jsdom makes use of process.platform which is not supported by browserify's process shim, resulting in this:

Mozilla/5.0 (undefined) AppleWebKit/537.36 (KHTML, like Gecko) jsdom/11.11.0

There's an open issue for it here, but based on the discussion I don't think we can expect a fix to be merged any time soon. Should we provide our own fallback value when process.platform is undefined?

@Zirro
Copy link
Member Author

Zirro commented Aug 4, 2018

Another option is to stop advertising process.platform in the user agent altogether (or to replace it with a static value in order to maintain a similarity with other User-Agent strings).

The values returned from Node's process.platform already don't match what browsers put there, and we return the empty string for navigator.platform.

Since custom user-agent strings can be set through the API, it shouldn't be a problem for anyone who needs a specific value.

@domenic
Copy link
Member

domenic commented Aug 13, 2018

Keeping this information seems vaguely valuable. I'm thinking maybe we should do a fallback of "unknown OS" in the browser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants