---
title: "Comment by Denny Trebbin on \"Detect Operating System using Javascript\" | Hashnode"
description: "The solution is attractive but not bulletproof. Changing the UserAgent in Safari is enough to trick the script into thinking I&#39;m on Windows. platform and ve"
url: "https://hashnode.com/posts/detect-operating-system-using-javascript/5f7704347d160d41227d6869/comment/5f774ccf9c3b6e4101215e0d"
---

[Discussion](https://hashnode.com/posts/detect-operating-system-using-javascript/5f7704347d160d41227d6869)

Comment [Detect Operating System using Javascript](https://hashnode.com/posts/detect-operating-system-using-javascript/5f7704347d160d41227d6869)

[Denny Trebbin](https://hashnode.com/@nerdalytics)

[Oct 2, 2020](https://hashnode.com/posts/detect-operating-system-using-javascript/5f7704347d160d41227d6869/comment/5f774ccf9c3b6e4101215e0d)

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.

![Windows detected after changing UserAgent](https://cdn.hashnode.com/res/hashnode/image/upload/v1601654227028/EBf5vi54Z.png)

![MacOS detected despite using iPhone UserAgent](https://cdn.hashnode.com/res/hashnode/image/upload/v1601654265328/Z0bUIncC6.png)

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

[Sarthak Roy](https://hashnode.com/@sarthakroy2002)

[Oct 3, 2020](https://hashnode.com/posts/detect-operating-system-using-javascript/5f7704347d160d41227d6869/comment/5f774ccf9c3b6e4101215e0d#reply-5f7804929c3b6e41012162e7)

Thanks...I have fixed it.....
