The solution is attractive but not bulletproof. Changing the UserAgent in Safari is enough to trick the script into thinking I'm on Windows.
platform and vendor offer more details than just appVersion alone.
And checking appVersion to contain "Mac" doesn't identify iPhone, iPad, or other Apple devices because "Mac" is always included in the appVersion on every Apple product.


But it's a good start to improve upon :-)