Categories
JavaScript Answers

How to detect 64-bit or 32-bit Windows from user agent with JavaScript?

Spread the love

Sometimes, we want to detect 64-bit or 32-bit Windows from user agent with JavaScript.

In this article, we’ll look at how to detect 64-bit or 32-bit Windows from user agent with JavaScript.

How to detect 64-bit or 32-bit Windows from user agent with JavaScript?

To detect 64-bit or 32-bit Windows from user agent with JavaScript, we can use the navigator.userAgent string property.

For instance, we write

if (
  navigator.userAgent.includes("WOW64") ||
  navigator.userAgent.includes("Win64")
) {
  console.log("This is a 64 bit OS");
} else {
  console.log("Not a 64 bit OS");
}

to check if navigator.userAgent includes 'WOW64' or the 'Win64' strings.

If it includes either one, then the user agent is the 64 bit Windows user agent.

Conclusion

To detect 64-bit or 32-bit Windows from user agent with JavaScript, we can use the navigator.userAgent string property.

Leave a Reply

Your email address will not be published.

If you like the content of this blog, subscribe to my email list to get exclusive articles not available to anyone else.