Created
November 24, 2014 10:36
-
-
Save arvindr21/b0ac9237bfe5ea39d41c to your computer and use it in GitHub Desktop.
Resize a popup window using javascript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var i=0; | |
function resize() { | |
i=0; | |
// if (navigator.appName == 'Netscape') i=20; | |
if (window.navigator.userAgent.indexOf('MSIE 6.0') != -1 && window.navigator.userAgent.indexOf('SV1') != -1) { | |
i=30; //This browser is Internet Explorer 6.x on Windows XP SP2 | |
} else if (window.navigator.userAgent.indexOf('MSIE 6.0') != -1) { | |
i=0; //This browser is Internet Explorer 6.x | |
} else if (window.navigator.userAgent.indexOf('Firefox') != -1 && window.navigator.userAgent.indexOf("Windows") != -1) { | |
i=25; //This browser is Firefox on Windows | |
} else if (window.navigator.userAgent.indexOf('Mozilla') != -1 && window.navigator.userAgent.indexOf("Windows") != -1) { | |
i=45; //This browser is Mozilla on Windows | |
} else { | |
i=80; //This is all other browsers including Mozilla on Linux | |
} | |
if (document.documentElement && document.documentElement.clientWidth) { | |
frameWidth = document.documentElement.clientWidth; | |
frameHeight = document.documentElement.clientHeight; | |
window.moveTo(0, 0); | |
// window.resizeTo(imgWidth, imgHeight); | |
window.resizeTo(screen.width,screen.height+i); | |
} | |
else if (document.body) { | |
window.resizeTo(document.body.clientWidth, document.body.clientHeight-i); | |
} | |
self.focus(); | |
} | |
setTimeout(function(){ | |
resize(); | |
}, 99); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
var i=0;
function resize() {
i=0;
// if (navigator.appName == 'Netscape') i=20;
if (window.navigator.userAgent.indexOf('MSIE 6.0') != -1 && window.navigator.userAgent.indexOf('SV1') != -1) {
i=30; //This browser is Internet Explorer 6.x on Windows XP SP2
} else if (window.navigator.userAgent.indexOf('MSIE 6.0') != -1) {
i=0; //This browser is Internet Explorer 6.x
} else if (window.navigator.userAgent.indexOf('Firefox') != -1 && window.navigator.userAgent.indexOf("Windows") != -1) {
i=25; //This browser is Firefox on Windows
} else if (window.navigator.userAgent.indexOf('Mozilla') != -1 && window.navigator.userAgent.indexOf("Windows") != -1) {
i=45; //This browser is Mozilla on Windows
} else {
i=80; //This is all other browsers including Mozilla on Linux
}
if (document.documentElement && document.documentElement.clientWidth) {
frameWidth = document.documentElement.clientWidth;
frameHeight = document.documentElement.clientHeight;
window.moveTo(0, 0);
// window.resizeTo(imgWidth, imgHeight);
window.resizeTo(screen.width,screen.height+i);
}
else if (document.body) {
window.resizeTo(document.body.clientWidth, document.body.clientHeight-i);
}
self.focus();
}
setTimeout(function(){
resize();
}, 99);