betweenGo

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.

Internet Explorer 8 invalid argument JavaScript error

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.

  • Share/Bookmark

Related posts:

  1. Twitter Weekly Updates for 2009-08-16
  2. Unobtrusive JavaScript
  3. Internet Explorer form does not invoke ATG handler
  4. Jumping to different parts of a page using a dropdown
  5. Turning off Perforce Windows Explorer Integration

:,

7 Comments for this entry

  • John

    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….?

    ;-)

  • Frank Kim

    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.” :-)

  • Li

    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

  • Frank Kim

    You are quite welcome Li. :-)

  • snw

    Name can’t have – either. That was my problem.
    Thanks for pointing me to the right direction!

  • jscolo

    Thanks. In addition to not allowing spaces, dashes are also not allowed.

  • Frank Kim

    Wow, not even dashes! Thanks for the info John. :-)

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!