Gravatar

Geoff Evason

Simple Javascript to detect browser details

Sometimes users of MomentVille will report a problem. It may be a javascript or css problem. Often, the first bit of info I need to find out is what browser they are using, and what their screen resolution is.

I thought it might be too tricky to get them to give me these details reliably, so I made a simple page that gives me the details I want. I just ask them to go to that page and copy and paste the text in an email. (Fortunately I don’t have to use it too often, but when I do it makes things easy).

The file looks as follows:


<html>
 <head>
  <title>Browser Check</title>
 </head>
 <body>
  <h3> Browser Info </h3>
  <br>
<script language="JavaScript" type="text/javascript">
<!--
document.write("navigator.appName " + navigator.appName + "<BR>");
document.write("navigator.userAgent " + navigator.userAgent + "<BR>");
document.write("navigator.appVersion " + navigator.appVersion + "<BR>");
//-->
</script>
  <h3> Resolution Info </h3>
<script language="JavaScript" type="text/javascript">
<!--
document.write("screen.width " + screen.width + "<BR>");
document.write("screen.height " + screen.height + "<BR>");
document.write("document.body.clientWidth" + document.body.clientWidth + "<BR>");
document.write("document.body.clientHeight" + document.body.clientHeight + "<BR>");
//-->
</script>
</body>
</html>

To see it in action check out: http://www.momentville.com/check_browser.html

Tags: , , ,

blog comments powered by Disqus