Skip to content

Instantly share code, notes, and snippets.

@dperini
Created August 3, 2010 16:36
Show Gist options
  • Save dperini/506692 to your computer and use it in GitHub Desktop.
Save dperini/506692 to your computer and use it in GitHub Desktop.
<html>
<head>
<title>IE capabilities detection (clientCaps)</title>
<script type="text/javascript">
var r = document.documentElement, capabilities;
r.addBehavior("#default#clientCaps");
capabilities =
"availHeight = " + r.availHeight + "\n" +
"availWidth = " + r.availWidth + "\n" +
"bufferDepth = " + r.bufferDepth + "\n" +
"colorDepth = " + r.colorDepth + "\n" +
"connectionType = " + r.connectionType + "\n" +
"cookieEnabled = " + r.cookieEnabled + "\n" +
"cpuClass = " + r.cpuClass + "\n" +
"height = " + r.height + "\n" +
"javaEnabled = " + r.javaEnabled + "\n" +
"platform = " + r.platform + "\n" +
"systemLanguage = " + r.systemLanguage + "\n" +
"userLanguage = " + r.userLanguage + "\n" +
"width = " + r.width + "\n";
window.onload = function () {
var output = document.getElementById('output');
output.innerText = capabilities;
}
</script>
</head>
<body>
<h1>IE capabilities detection (clientCaps)</h1>
<p>This shows how to detect IE capabilities in advance, as soon as the
Javascript interpreter executes the code by using the <b>clientCaps</b>
behavior and without the needs to wait for an "onload" event.</p>
<p>The original example and informations were taken directly from on-line
<a href="http://msdn.microsoft.com/en-us/library/ms535922(VS.85).aspx">Microsoft documentation</a>.</p>
<pre id="output"></pre>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment