Prevent javascript from resizing IE window

6,759

Solution 1

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.

Solution 2

This might help you IE7 Window Resize

Solution 3

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.

Share:
6,759

Related videos on Youtube

Jared Harley
Author by

Jared Harley

Updated on September 17, 2022

Comments

  • Jared Harley
    Jared Harley over 1 year

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

  • DrColossos
    DrColossos over 14 years
    Cures the disease by killing the patient.
  • Nathaniel
    Nathaniel over 14 years
    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 (ie7pro.com), because it supports userscripts.
  • ukanth
    ukanth over 14 years
  • Shrike
    Shrike over 14 years
    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.