Link to home
Start Free TrialLog in
Avatar of AhmedHindy
AhmedHindyFlag for Egypt

asked on

window.resizeto not working chrome

Hey All of You ,
I am having this problem that
window.resizeto is  not working in  chrome
how ever it works fine with IE
here is the code
 
<script type="text/javascript">

window.onresize = resize;

function resize()
{
 
    window.resizeTo(screen.width, screen.height);
alert("rezied !")
}



</script>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of designatedinitializer
designatedinitializer
Flag of Portugal image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Michel Plungjan
Looking at this script, I suggest the following changes to adhere to best practices

<html>
<head>
<script type="text/javascript">
	window.onresize = function() { // no need to name the function if that is all you do in the event
		// do not use interval if you do not need interval
                // using quotes in a timeout/interval is an implicit EVAL and not good practice
		window.setTimeout(resize,500); 
	}
	function resize() {
		window.moveTo(0, 0);
		window.resizeTo(screen.width, screen.height);
	}
</script>
<body>
.
.
</body>
</html>

Open in new window