teenashah
asked on
Maintain minimum width and height of browser window when resizing
Hi,
I want resize browser window to 1000x700 pixel by default on load of html page. Also whenever you resize window the minimum dimension 1000x700 should be maintained. I tried
window.onresize = function(){
window.resizeTo(1000,700);
};
but in IE8 its not working giving error "Access denied", however in FF its work fine.
Please guide me with some alternate solution that can be handled using JavaScript
I want resize browser window to 1000x700 pixel by default on load of html page. Also whenever you resize window the minimum dimension 1000x700 should be maintained. I tried
window.onresize = function(){
window.resizeTo(1000,700);
};
but in IE8 its not working giving error "Access denied", however in FF its work fine.
Please guide me with some alternate solution that can be handled using JavaScript
ASKER
Hi gurvinder372,
In my question onlly i am applying fixed height and width on resize event of window. It works some how in FF but not in IE8.
In my question onlly i am applying fixed height and width on resize event of window. It works some how in FF but not in IE8.
this code is working fine on my machine
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<script>
function resizeWindow()
{
window.resizeTo(100,100);
}
</script>
</HEAD>
<BODY BGCOLOR="#FFFFFF" onload='resizeWindow()'>
</BODY>
</HTML>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<script>
function resizeWindow()
{
window.resizeTo(100,100);
}
</script>
</HEAD>
<BODY BGCOLOR="#FFFFFF" onload='resizeWindow()'>
</BODY>
</HTML>
ASKER
Hi gurvinder372;
Thanks for quick response. You code perfectly works, when i tried on other's machine. So onlaod event of body browser resizes to given dimension. But when onresize is getting fired with resizeto function IE8 gives "Access denied" error. Is it because of Ie not allowing this methode to execurte?
Thanks for quick response. You code perfectly works, when i tried on other's machine. So onlaod event of body browser resizes to given dimension. But when onresize is getting fired with resizeto function IE8 gives "Access denied" error. Is it because of Ie not allowing this methode to execurte?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yes, it seems to be right solution
if it is lesser than certain value, invoke window.resizeTo(minwidth, minheight);
http://www.javascriptkit.com/jsref/window.shtml