Redirect by screen size and web browser

[Total: 0    Average: 0/5]

This determines the users screen size and web browser to make a determination of where to send the user.

Body Code:

<script type=text/javascript>
var isIE = document.all?true:false;
var isNS = document.layers?true:false;
var dimW = screen.width;
var dimH = screen.height;

// IE and NS added alot of DHTML capability in their 4 versions
var isDHTML = (parseFloat(navigator.appVersion.split(" ")[0])>=4.0)?true:false;
function doIt() {
  var _loc = "http://www.js-examples.com/"; // default
  if (isDHTML) {
    if (isIE && dimW==800  && dimH==600) _loc = "http://www.js-examples.com/";
    if (isIE && dimW==1024 && dimH==768) _loc = "http://www.js-examples.com/js/";
    if (isNS && dimW==800  && dimH==600) _loc = "http://www.js-examples.com/forum/";
    if (isNS && dimW==1024 && dimH==768) _loc = "http://www.js-examples.com/forum/cindex.html";
  }
  top.document.location=_loc;
}

</script> 
<a href="javascript:doIt()">Run Test and Re-Direction</a>

Times Viewed: 0

Leave a Reply

Your email address will not be published. Required fields are marked *