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

Clarify that navigator.userAgentData is not mature #12017

Merged
merged 1 commit into from
Jan 18, 2022

Conversation

sideshowbarker
Copy link
Collaborator

Fixes #11934

@github-actions
Copy link
Contributor

github-actions bot commented Jan 15, 2022

Preview URLs

Flaws

None! 🎉

External URLs

URL: /en-US/docs/Web/API/Navigator/platform
Title: Navigator.platform
on GitHub

No new external URLs

(this comment was updated 2022-01-15 05:14:23.603775)

@sideshowbarker sideshowbarker requested review from wbamberg and removed request for jpmedley January 15, 2022 05:07
@sideshowbarker sideshowbarker force-pushed the sideshowbarker/navigator/platform-status branch from c496a9f to e19d663 Compare January 15, 2022 05:12
@wbamberg
Copy link
Collaborator

I thought it was weird to deprecate a feature when the replacement isn't available cross-browser or even standardised! Do you know where it is deprecated? https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-platform-dev doesn't say anything to that effect.

@sideshowbarker
Copy link
Collaborator Author

sideshowbarker commented Jan 15, 2022

I thought it was weird to deprecate a feature when the replacement isn't available cross-browser or even standardised! Do you know where it is deprecated? html.spec.whatwg.org/multipage/system-state.html#dom-navigator-platform-dev doesn't say anything to that effect.

There’s been discussion about this elsewhere, but the gist of it is:

  • this is one of key use cases for our proposed “Discouraged” language (vs “Deprecated”) — as discussed in https://github.com/mdn/content/discussions/5549
  • developers should not use navigator.platform because it’s not guaranteed to return what they’d expect.

Specifically, the spec allows browsers to simply return the empty string fornavigator.platform. That’s not what developers would expect it to return, and it’s not useful in any way. So we want to warn developers away from trying to use it. That’s also why we have the existing MDN article saying:

The specification allows browsers to always return the empty string, so don't rely on this property to get a reliable answer.

Further, in general most everything in the NavigatorID mixin https://html.spec.whatwg.org/multipage/system-state.html#client-identification is effectively deprecated because:

  • At the end of https://html.spec.whatwg.org/multipage/system-state.html#client-identification the spec has a big red note that ends with:

    user agent implementers are strongly urged to include as little information in this API as possible.

  • As with navigator.platform, most of the members are defined by the spec either as never returning any useful information at all, or else optionally returning something marginally useful, or nothing at useful at all.

In other words, the spec doesn’t deprecate the features but instead actually normatively defines requirements for them — however, the spec-defined requirements intentionally make the features effectively useless or unreliable to developers.

Hence we want to discourage developers from trying to use the features.

Copy link
Collaborator

@wbamberg wbamberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the clarification @sideshowbarker !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:WebAPI Web API docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issue with "Navigator.platform": premature recommendation to move to NavigatorUAData.platform
2 participants