Friday, May 9, 2008

Firefox Overriding Window Resizable Parameter

THE FOLLOWING ORIGINAL POST HAS BEEN UPDATED AS OF 14 MAY 2008 -- SEE BOTTOM OF POST FOR UPDATES

As of today I've decided that my blog is going to be about random annoyances on the web. Such as today's topic: FireFox Overriding Window Resizable Parameter. Essentially, if you are a web developer and you use the following (or similar) code to open a new "popup" window.

function popup(winLink, winName, winWidth, winHeight, winResize, winScroll, winMenu) {
if(winWidth == undefined || winWidth == NaN) {
winWidth = 400;

}
if(winHeight == undefined || winHeight == NaN) {
winHeight = 400;

}
if(winResize == undefined || (winResize != "yes" && winResize != "no" && winResize != 1 && winResize != 0 && winResize.constructor != Boolean)) {
winResize = "yes";

}
if(winScroll == undefined || (winScroll != "yes" && winScroll != "no" && winScroll != 1 && winScroll != 0 && winScroll.constructor != Boolean)) {
winScroll = "yes";

}
if(winMenu == undefined || (winMenu != "yes" && winMenu != "no" && winMenu!= 1 && winMenu != 0 && winMenu.constructor != Boolean)) {
winMenu = "no";

}
if(!window.focus) {
return true;

}
var winURL;
if(typeof(winLink) == 'string') {
winURL=winLink;

}
else {
winURL=winLink.href;

}
var winStyle;
winStyle = 'width=' + winWidth + ',height=' + winHeight + ',scrollbars=' + winScroll + ',menubar=' + winMenu + ',location=' + winMenu + ',toolbar=' + winMenu + ',resizable=' + winResize;
window.open(winURL, winName, winStyle);
return false;

}
Even if you pass in values to allow resizing, FireFox overrides it with the default. And as far as I've seen, the default install setting is to disable window resizing. Of course, if you are a smart enough user you can change that in the "about:config" settings see this blog on how to do this, but the fact is, most users don't know about this. And this really puts a strain on website developers trying to make their sites as usable as possible.

Now, ranting about these issues is well and good, but the other part of my blog will be workarounds for these issues. I haven't found one yet, but I will be working on this as I feel it is important to not just complain about something if you don't try to do something to solve it. So look forward to that, and if you have ideas for a workaround, feel free to post a comment.

UPDATED: 14 May 2008 9:47 PM PST
I've updated the function above, part of the "bug" was a spelling error. And Firefox only overrides the default when the dom.disable_window_open_feature.resizable is set to true (which means windows will ALWAYS be resizable). So the above function should work properly.

No comments: