To get the system type (whether the system is Windows, MacOS, or Linux), you can use the navigator.platform
property in JavaScript. Here's an example code snippet:
index.tsx357 chars14 lines
This code checks the value of navigator.platform
for the presence of "Win"
, "Mac"
, and "Linux"
to determine the system type. If none of these are found, the system type is set to "Unknown"
.
gistlibby LogSnag