JavaScript Invalid Argument in Internet Explorer Only
by Frank Kim on Aug.11, 2009, under JavaScript
Today I noticed one of my links were not working. This was only happening in Internet Explorer 8. Looking down at the status bar in the lower left corner I saw the message “Error on page.” Double-clicking on it popped up this window full of useless information.
A Google search for “internet explorer invalid argument” brought me to this page, Internet Explorer Sucks. Fortunately the author had run into this problem and figured out the solution.
It turns out In Internet Explorer, the second argument to the JavaScript window.open method, which is the windowName argument, can’t have spaces. My original link looked like this.
<a href="javascript:void(0);" onclick="window.open('popUp.jsp','Frank Kim betweenGo','menubar=0,toolbar=0,location=0,scrollbars=yes,width=400,height=175')">What's this?</a>
When I took out the spaces from the windowName argument the link worked. You would think Internet Explorer 8 would have fixed this issue by now, it doesn’t affect any other modern web browser.
Related posts:

August 18th, 2009 on 2:36 AM
A massive thank you for sharing this information. I had exactly the same problem. Firefox was fine but IE was doing what it is good at and stressing me out! Your solution worked perfectly.
I wonder if I could sue Bill Gates for loss of hair and a drinking habit….?
August 18th, 2009 on 2:42 PM
Thanks John. Your thank you comment is almost exactly the same as the thank you comment I left in the blog post I referenced, “Internet Explorer Sucks.”
September 21st, 2009 on 6:42 AM
Thank you so much!!! I have been pulling my hair for twenty minutes when I came across this page: I had a space in the name field of my new window. I would never thought of it. Thank you so much.
Li
September 21st, 2009 on 6:44 AM
You are quite welcome Li.
January 2nd, 2010 on 3:09 PM
Name can’t have – either. That was my problem.
Thanks for pointing me to the right direction!
January 19th, 2010 on 7:50 AM
Thanks. In addition to not allowing spaces, dashes are also not allowed.
January 19th, 2010 on 7:56 AM
Wow, not even dashes! Thanks for the info John.
March 10th, 2010 on 6:36 AM
Thanks! It worked just fine. God bless!
March 10th, 2010 on 9:13 PM
Thanks a ton for this info. Have been searching around for quite some time for a solution.