autoresolution


<html>
<head>
<title>JavaScript detects screen size upon load</title>
<script language="javascript" type="text/javascript">
function testRes(){
// Take a look at
//http://www.webdevtips.co.uk/webdevtips/faq/javascript/index.shtml
//
//opera Netscape 6 Netscape 4x Mozilla
if (window.innerWidth || window.innerHeight){
docwidth = window.innerWidth;
docheight = window.innerHeight;
}
//IE Mozilla
if (document.body.clientWidth || document.body.clientHeight){
docwidth = document.body.clientWidth;
docheight = document.body.clientHeight;
}
alert("the width = "+docwidth+" height = "+docheight);
if(docwidth>=800){
// take a look at
// http://www.tizag.com/javascriptT/javascriptredirect.php
window.location = "http://www.facebook.com";
}
else{
window.location = "http://www.google.com";
}
}
</script>
</head>
<body onLoad="testRes();">
<p>No buttons</p>
</body>
</html>