How do you know if the user is using a Mac?
So I found this code online:
The problem is that
platform
is deprecated, what can I use instead? This is the entire code, basically i'm trying to run a function if the user presses CTRL + S
or CMD + S
ofc
5 Replies
i wouldn't do any of that, and just check if either control or meta were pressed
this way, your code works the same on linux and macos as well
right, i'm dumb
thank you
it's not a matter of you being dumb or smart
it's just a matter of simplifying things
and this way, you simplify and give the user a choice
oh, and it's a lot less work for you too
Check the user-agent
the user agent can be spoofed, making it effectively useless