Page 1 of 1

IE denies my window.resizeTo and window.moveTo

Posted: Thu Jan 15, 2009 6:26 am
by Sindarin
I want to use a DRM wrapper (softwarePassport) which supports integration of html elements (using IE activeX control) to activate the wrapped software etc.
Because the program itself doesn't contain an option to make the html window resizable or not, I thought to use javascript in order to make the window non-resizable,

Firefox executes my code but IE denies to execute the script.

First I used this code to check with a timeout and resize:

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
 
<SCRIPT LANGUAGE="JavaScript">
function alarm()
{
var t=setTimeout("javascript&#058;doResize()",2);
}
 
function doResize() {
    var x = 800;
    var y = 600;
    window.resizeTo(x, y);
    window.moveTo(screen.width/6,screen.height/6);
    var t2=setTimeout("javascript&#058;alarm()",2);
}
 
</SCRIPT>
</head>
 
<body onload="alarm();">
 
</body >
</html>
Worked in Firefox, IE denied access.

So I thought to use the onresize event:

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>test</title>
 
<SCRIPT LANGUAGE="JavaScript">
 
function doResize() {
    var x = 800;
    var y = 600;
    window.resizeTo(x,y);
    window.moveTo(screen.width/6,screen.height/6);
}
 
</SCRIPT>
</head>
 
<body onresize="javascript&#058;doResize()">
 
</body >
</html>
But this doesn't work either. Any ideas?

Re: IE denies my window.resizeTo and window.moveTo

Posted: Thu Jan 15, 2009 7:09 am
by VladSun
I haven't seen this usage before:
[js]setTimeout("javascript&#058;doResize()",2);[/js]

I think it should be:
[js]setTimeout("doResize()",2);[/js]
The same applies to event handling:

Code: Select all

<body onresize="doResize()">
PS: Yes, I know that the forum converts ":" to &#058; ;)

Re: IE denies my window.resizeTo and window.moveTo

Posted: Thu Jan 15, 2009 7:14 am
by Eran
Even better, use a callback:

Code: Select all

setTimeout(function() {
 
}, 2);

Re: IE denies my window.resizeTo and window.moveTo

Posted: Mon Jan 19, 2009 1:04 pm
by Sindarin
Still IE denies access to the script function.