Thursday, July 15, 2004

Window args and errors

What's wrong with this picture?

window.open("example.html","Example Window",
"scrollbars=no");

Moz/Firefox will pop open a new window, but IE6 will throw an "Invalid Argument" error. Why?

The second argument to window.open is the name of the window. In IE6, this cannot contain any spaces or special characters. Some people mistakenly think this argument is for the title of the window. So they put in something human-readable (like "Example Window"), thus the error.

12 Comments:

At 8:39 AM, Blogger Scott Clark said...

Thank you so much for this little article. I was struggling with why my function would pop a window in Firefox and not in IE. I really appreciate you taking a moment to share this little tid-bit of info.

 
At 8:29 AM, Blogger Rob said...

Where were you a few months ago when I spent two hours Googling up the answer to why my windows wouldn't open?

Love the site, keep it coming.

 
At 6:26 AM, Blogger HiiFii Webservices said...

I liked you Blog so much,so i also wanted to show you some good resourses on the net.
Learn to earn 90000$/Month
For which you may also see my Personal Website
Here.
and for a Personal Education Career Tools
free Study Database.
This site is for seeing the
Hifi Electronics.
And this is for
World Class Gadgets

 
At 3:10 AM, Blogger Ikar said...

Thank you. You saved our time when customer changed source code of page and then asked us to fix the trouble with popup. Without your post we would spend much more time.

 
At 1:09 PM, Blogger esfisher said...

Man, I love it when I type in my obscure problem in Google and a site pops up right away with the answer. Great job! I loved reading the rest of your blog as well!

 
At 6:51 AM, Blogger Graham said...

Thanks for this, I've spent a lot of the afternoon getting mad at IE for not popping up my window, now I feel stupid ...
Cheers

 
At 1:18 PM, Blogger unknowne said...

I feel stupid also, hehe.

Thanks a lot for this, it was driving me crazy!

 
At 3:17 AM, Blogger Sul said...

thx for saving the rest of the day...
&
IE sucks!

 
At 7:50 AM, Blogger Rakesh said...

Thank you .. this problem wasted one complete day of mine

Thanks for your post which helped

 
At 5:21 PM, Blogger Sane Pete said...

Thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you

This has been doing my nut in.

 
At 5:21 PM, Blogger Sane Pete said...

Thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you.

This prob has been doing my nut in!

 
At 6:11 PM, Blogger W!ll!iam said...

thank you, spent 2hours trying to get it working. thanks for the tid bit of knowledge.

 

Post a Comment

<< Home