Prevent javascript from resizing IE window

10

2

I am looking for a way to prevent JavaScript on a webpage from resizing and repositioning my Internet Explorer window.

This option is available in Firefox, but I can't find anything similar in Internet Explorer:

Firefox Javascript Options window

I am using Internet Explorer 7 in Windows XP SP3.

For what it's worth, the script doing the resizing is:

<script language="JavaScript">
    function getFocus(){
        document.frmLogin.txtUsername.focus();
        window.moveTo(0,0);
        window.resizeTo(screen.availWidth,screen.availHeight);
    }
    window.onload = getFocus;
</script>

and this script seems to not resize the window with Internet Explorer 8, but upgrading is not currently an option (work computer).

Jared Harley

Posted 2009-09-09T15:00:38.923

Reputation: 11 692

Answers

2

I emailed the Internet Explorer team at the IEBlog and received the following response:

No, IE doesn't have options that are that fine-grained.

Jared Harley

Posted 2009-09-09T15:00:38.923

Reputation: 11 692

1

On a browser with such option (like Firefox or Opera), you can just disable that option at the preferences. It seems you can't do that in IE.

On a browser with support for User Javascript (like Opera, or Firefox with Greasemonkey extension), you can write a script to replace window.moveTo and window.resizeTo functions with dummy versions (or just disable them). Of course, IE does not support that.

Then, you can try to inject JavaScript code in HTML by using any content-filtering program (in other words, a personal web proxy), like Proxomitron (old, abandonware) or Privoxy (free software, GPL). A software like this will intercept HTTP requests and modify them (according to some rules) before delivering the content back to the browser. This means you can not only inject content, but also remove that offending script from the page.

Denilson Sá Maia

Posted 2009-09-09T15:00:38.923

Reputation: 9 603

If you know how to write such a script or can get someone to write it for you or find one already written... AND you're willing to use an alternate shell for IE, you might look into IE7Pro (http://www.ie7pro.com/), because it supports userscripts.

– Nathaniel – 2009-09-14T02:46:48.367

1

This might help you IE7 Window Resize

ukanth

Posted 2009-09-09T15:00:38.923

Reputation: 9 930

There is a good write up at http://blogs.msdn.com/ie/archive/2006/08/25/719355.aspx

– ukanth – 2009-09-14T09:23:48.747

0

The only way to do this would be to dissable JavaScript.

Click Tools Menu > Internet Options > Security Tab > Custom Level > Scripting > Active Scripting

Greg B

Posted 2009-09-09T15:00:38.923

Reputation: 998

8Cures the disease by killing the patient. – Kevin Panko – 2009-09-11T16:32:18.440

Any brighter ideas? As far as I know you dont have this level of control in IE. It's all or nothing... Say good bye to the patient. – Greg B – 2009-09-14T14:45:05.153