Javascript examples for Browser Object Model:Navigator
The userAgent property returns the user-agent header sent by the browser to the server.
The user-agent header contains information about the name, version and platform of the browser.
This property is read-only.
A String, representing the user agent string for the current browser
The user-agent header sent by your browser is:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/*from w w w . ja va 2 s .c o m*/ var x = "User-agent header sent: " + navigator.userAgent; document.getElementById("demo").innerHTML = x; } </script> </body> </html>