View Full Version : Resolved [SOLVED] Bug testing in IE8 - invalid argument error

06-24-2011, 07:03 AM

So I'm testing my webpage in IE8. In firefox it looks and runs greag, but in IE 8, one issue I'm having is this: I have a button that opens a popup window. Works fine in Firefox, but I get 'invalid argument' error in IE8 and the window does not open. I've enabled at a whim some scripting things in the Internet Options hoping that would resolve the issue, but not so. Here's the code. The "invalid argument" occurs on the window.open call.

function open_report()
var report_vars = created_URL;
report_vars = report_vars.substr(69);
report_array = report_vars.split('=');
var from_d = report_array[2].substr(0,10);
var to_d = report_array[3].substr(0,10);
window.open('detailedreport.shtml' + report_vars, 'My Site | Detailed Report - ' + from_d + ' to ' + to_d, 'title=yes, status=no, toolbar=no, location=no, menubar=no, scrollbars=yes, modal=yes, alwaysRaised=yes, width=' + window.outerWidth / 1.1 + ', height=' + window.outerHeight);

In addition, is there any way to have that tile I've given it, "my Site..." appear in the window header? Right now it's not appearing at all in either browser.

Thanks for reading!

06-24-2011, 07:16 AM
The way you specify your various parameters in your window.open() doesn't look right to me.

The w3schools tute on window.open (http://www.w3schools.com/jsref/met_win_open.asp) gives details on how the function works.

Try using alert() or a debugger to see what the values of the input parameters actually are to find the invalid one(s).

Old Pedant
06-24-2011, 08:07 AM
And the second argument to window.open is *NOT* the title of the window. It is the *NAME* of the window. It's possible that the name is what MSIE is barfing on, though I agree with bullant that the url looks suspicious.

If you want to set the title, you can do that *after* the window is open:

var w = window.open( url, windowname, options );
w.title = "whatever makes sense";

06-24-2011, 08:30 AM
Could be the other browsers are ignoring the gibberish, but IE (before #9) will choke on window.outerWidth and window.outerHeight.

Old Pedant
06-24-2011, 08:33 AM
Ahhh...good catch...didn't even notice those out at the end of the options!

Teach me to assume.

06-24-2011, 08:36 AM
Looks like I was treating the 'name' argument as a place to put my <title>.... thanks for the tip!