frc-docs icon indicating copy to clipboard operation
frc-docs copied to clipboard

WPILib install page fails to detect OS in Firefox or Safari

Open auscompgeek opened this issue 11 months ago • 3 comments

On https://docs.wpilib.org/en/stable/docs/zero-to-robot/step-2/wpilib-setup.html I get the following error in the console.

Uncaught (in promise) TypeError: navigator.userAgentData is undefined
    <anonymous> https://docs.wpilib.org/en/stable/docs/zero-to-robot/step-2/wpilib-setup.html:926

screenshot

The offending source code line:

https://github.com/wpilibsuite/frc-docs/blob/f8306ce0759e9ce5eb504178a16ae2e49e3de5d3/source/_extensions/wpilib_release.py#L86

auscompgeek avatar May 10 '25 05:05 auscompgeek

That feature is only supported in Chrome because other browsers don't expose that api.

TheTripleV avatar May 10 '25 05:05 TheTripleV

https://caniuse.com/mdn-api_navigator_useragentdata

TheTripleV avatar May 10 '25 05:05 TheTripleV

Using navigator.oscpu would work on Windows Firefox. On macos:

  • Chrome works currently
  • Firefox doesn't currently work but could work in a hacky way: oscpu always returns MacIntel, even on arm macs. But loading webgpu and querying the gpu name will differentiate the 2 architectures.
  • Safari doesn't work.

TheTripleV avatar May 10 '25 07:05 TheTripleV