IE denies my window.resizeTo and window.moveTo

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
Sindarin
Forum Regular
Posts: 521
Joined: Tue Sep 25, 2007 8:36 am
Location: Greece

IE denies my window.resizeTo and window.moveTo

Post 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?
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

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

Post 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; ;)
There are 10 types of people in this world, those who understand binary and those who don't
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

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

Post by Eran »

Even better, use a callback:

Code: Select all

setTimeout(function() {
 
}, 2);
User avatar
Sindarin
Forum Regular
Posts: 521
Joined: Tue Sep 25, 2007 8:36 am
Location: Greece

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

Post by Sindarin »

Still IE denies access to the script function.
Post Reply