Fix OS detection for Firefox and Safari browsers#3116
Fix OS detection for Firefox and Safari browsers#3116jasondaming wants to merge 1 commit intowpilibsuite:mainfrom
Conversation
Add fallback to userAgent parsing when userAgentData is unavailable. Chromium-based browsers use the modern userAgentData API, while Firefox and Safari fall back to traditional userAgent string parsing. For macOS, detects Intel vs ARM by checking for "Intel Mac OS X" in the user agent string. Fixes wpilibsuite#3032
|
@TheTripleV Any ideas on how to test this? It looks like the RTD PR builds don't work either on this PR or on other PRs. |
|
Oh I think I tried to use LLMs on this one but they always hallucinated. You can have Claude detect Safari and make it assume that Safari means Apple Silicon if you want. Firefox does not support the chrome api. It might work through
but idk I'm not sure why it's not rendering. js nested in html nested in rst nested in python is a bit cursed and there might be a syntax error somewhere or there might be a cors issue on pr builds. |
|
funny enough this might be the hardest frc-docs issue for an llm to tackle |
Summary
Adds fallback to userAgent parsing when userAgentData API is unavailable, fixing OS detection for Firefox and Safari browsers.
Changes
navigator.userAgentDataexists before using itnavigator.userAgentstring parsing for Firefox/SafariFixes #3032