Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

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

You are here: irt.org | FAQ | JavaScript | Window | Q1040 [ previous next ]

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>

©2018 Martin Webb