Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q1040 How do I prevent the browser window from being resized?

irt.org | Knowledge Base | JavaScript | Window | Q1040 [ previous next ]

Q1040 How do I prevent the browser window from being resized?

I don't this there is a 100% fool proof method. When you create a new window you can specify resizable=no:

<script language="JavaScript"><!--
window.open('about:blank','windowName','resizable=no,width=640,height=480');
//--></script>

In Netscape Navigator 4 if is also possible to set the resizable property of the current window - but only gaining universalBrowserWrite privileges:

<script language="JavaScript1.2"><!--
if (document.layers) {
    netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserWrite');

    window.setResizable(false);
}
//--></script>

But in both cases I don't think this stops the user from resizing the browser on all platforms.

The following was submitted by Pak Ki So

I may have stumbled upon something better for the problem of resizing in Netscape. I found this neat piece of code from PC Mag. Unfortunately, I am still searching for the IE solution:

<SCRIPT LANGUAGE="JavaScript">
if (document.layers) { window.onResize = reloadNow; }
function reloadNow() {
  document.location = document.location;
}
</SCRIPT>

Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.