Start New Discussion within our Web Development Community

Is ther anothe easy way to detect browser used and versions and Operating system via javascripts?

I appreciate your help

The user-agent string contains the information you need. Using JavaScript you can access it through the browser's navigator object, e.g. navigator.userAgent.

Thanks sir
It seems not work for me

<!doctype html>
<html lang="en">
<meta charset="utf-8">
<title>Inform about user browser and Os</title>

<button id="display" onclick="myFunction()">Detect User browser and Operativ system</button>

    function myFunction()
        var x = "User-agent header sent: " + navigator.userAgent;


Line 16, document.getElementById("demo") is returning null. There is no element with the ID demo.

Insert something like <p id="demo"></p> at line 11 and you should find it'll work.

Thanks Sir
Its work
What about detecting operation system?Have you any idea?

You simply need to parse the string. So for example...

Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36

In this string, you can tell that the user is running Windows 8.1 because "Windows NT 6.3" indicates that the OS is Windows 8.1

This question has already been answered. Start a new discussion instead.