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

Fallback for deprecated window.navigator.platform #208

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

yoannmoinet
Copy link

@yoannmoinet yoannmoinet commented Feb 16, 2025

Adding a fallback for the now deprecated window.navigator.platform.

The best alternative seems to be to usewindow.navigator.userAgentData.platform.

Mentioned in #182

I didn't find much contribution guide, so let me know if you need me to give more information.

@yoannmoinet yoannmoinet marked this pull request as ready for review February 16, 2025 18:48
@yoannmoinet yoannmoinet changed the title Fallback for deprecated window.navigator.platform Fallback for deprecated window.navigator.platform Feb 16, 2025
Copy link
Collaborator

@BruceMacD BruceMacD left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution, some minor feedback

Comment on lines +96 to +99
const platform = window.navigator.platform || window.navigator.userAgentData?.platform;
if (!platform) {
return '';
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
const platform = window.navigator.platform || window.navigator.userAgentData?.platform;
if (!platform) {
return '';
}
const platform =
window.navigator.platform ||
window.navigator.userAgentData?.platform ||
'unknown';

I think we can simplify to this

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

Successfully merging this pull request may close these issues.

2 participants