chrome resize window javascript

// SEE https://stackoverflow.com/a/7452099/8251524 for important facts
// about limitations when used beyond development.

if(navigator.userAgent.toLowerCase().indexOf('chrome') > -1)
    var t = setTimeout("resize()", 200);
else
    resize();

function resize() {
    var innerWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
    var innerHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
    var targetWidth = 800;
    var targetHeight = 600;
    window.resizeBy(targetWidth-innerWidth, targetHeight-innerHeight);
}
Harry Fahringer III