Prevent javascript from resizing IE window

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).


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.


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.


This might help you IE7 Window Resize