Sometimes, we want to detect browser version and operating system using JavaScript.
In this article, we’ll look at how to detect browser version and operating system using JavaScript.
How to detect browser version and operating system using JavaScript?
To detect browser version and operating system using JavaScript, we an use the platform.js library.
To install it, we run
npm i --save platform
Then we use it by writing
const platform = require("platform");
console.log(platform.name);
console.log(platform.version);
console.log(platform.layout);
console.log(platform.os);
console.log(platform.description);
We get the browser name with platform.name
.
platform.version
has the browser version.
platform.layut
has the layout engine name.
platform.os
has the OS name.
platform.description
has the description string of the browser engine.
Conclusion
To detect browser version and operating system using JavaScript, we an use the platform.js library.