<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Mobile-Web-App: Detect Browser</title> <script type="text/javascript"> function detectbrowser(){ info = "<p><b>Browser info: </b></p>" + "<p>user agent: " + navigator.userAgent + "</p>"; document.getElementById("browserinfo").innerHTML=info; } </script> </head> <body onload="detectbrowser();"> <h1>Mobile-Web-App: Javascript Exercise - Detect User Agent</h1> <div id="browserinfo"></div> </body> </html>
Tuesday, May 7, 2013
Detect user agent using javascript
To detect user agent in JavaScript, simple read navigator.userAgent.
Labels:
Code.Javascript
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment