3

How can I detect the current operating system in my react js PWA project.I have used process.platform but it gives "undefined".Please help

  • You can refer this post: https://stackoverflow.com/questions/38241480/detect-macos-ios-windows-android-and-linux-os-with-js – Manoj Feb 11 '21 at 02:56

2 Answers2

3

Your best bet is const platform = window.navigator.platform

Praveen Nambiar
  • 4,852
  • 1
  • 22
  • 31
0

Values for the operating systems:

const platform = window.navigator.userAgentData.platform;

Navin
  • 1
  • 1
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Nov 03 '22 at 09:14