Opening Popups in IE (January 4th, 2005)

Recently I ran across a rather strange error with different browser. Popup windows could be maximized in Opera and Mozilla, but not in IE. The code I was using was as follows (click here to try):

window.open(”, ”, ‘width=200,height=200’);

After some digging, I ran across the following snippet in MSDN:

When the sFeatures parameter is specified, the features that are not defined in the parameter are disabled. Therefore, when using the sFeatures parameter, it is necessary to enable all the features that are to be included in the new window.

My mistake in IE was that I specified the height and the width WITHOUT telling the browser about the resizability. Here is the corrected code (click here to try):

window.open(”, ”, ‘width=200,height=200’,resizable=yes);

But that still doesn’t explain why it worked in Opera or Mozilla. So after some more digging, an article at QuirksMode.org informed me that:

The popup is always resizable in Mozilla, Safari and Opera.

Go figure.

UPDATE: In response to a comment accusing Microsoft of not being HTML-compliant, I want to explain why in this case Microsoft is actually right. The “window.open” method is not defined in any public standard. The only places where it is defined is Netscape’s documentation for JavaScript and Microsoft’s IE documentation,where a resizable flag is mentioned in BOTH. This specific behavior is part of what is known “DOM Level 0” which according to the W3C is defined as follows:

DOM Level 0

Functionalities equivalent to the ones exposed in Netscape Navigator 3.0 and Microsoft Internet Explorer 3.0 are informally referred to as “Level 0”. There is no W3C specification for this Level.

Microsoft’s documentation states that as well:

Standards Information

There is no public standard that applies to this method.

According to QuirksMode.org Netscape 4 had the resizable flag but for some reason starting with Mozilla v1.4 and in both Opera and Safari this flag is no longer present. So in this case, Microsoft is right by preservering the functionality of the resizable flag exactly the same way it has been implemented in IE 4 and Netscape 4.

Comments?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s