Browser Detection In JavaScript
We can Detect the visitor's browser with the help of Navigator Object In JavaScript.
Ex:
- <html>
-
- <body>
- <div id="browserdetection"></div>
- <script type="text/javascript">
- x = "<p>Browser CodeName: " + navigator.appCodeName + "</p>";
- x += "<p>Browser Name: " + navigator.appName + "</p>";
- x += "<p>Cookies Enabled: " + navigator.cookieEnabled + "</p>";
- x += "<p>Browser Version: " + navigator.appVersion + "</p>";
- document.getElementById("browserdetection").innerHTML = x;
- </script>
- </body>
-
- </html>