SCRIPT87: Invalid argument in IE 9, ASP.NET C#

14,972

IE9 debugger works and fails on your window.open command.

IE doesn't like the space in the windowName argument – "Manage Domain".

Remove any spaces, hyphens, and underscores (unless you want _blank) and try again.

Share:
14,972
Drew
Author by

Drew

Updated on June 05, 2022

Comments

  • Drew
    Drew almost 2 years

    This is working in all other browsers except IE. I am building a link in the code behind in c#:

    string link = <a onclick=\"Myfunction('" + Server.UrlEncode(mystring) + "');\" href=\"javascript:void(0);\">Open Pop Up Window</a>
    

    This is my javascript function:

     function Myfunction(pMyString) {
            CloseWindow();
    
            var url = "DomainPath/MyPage.aspx?Site=" + pMyString;
            win = window.open(url, "Manage Domain", 'toolbar=no,location=no,status=no,directories=no,scrollbars=yes,resizable=no,width='+700+',height='+500);
        }
    

    If the function is added to an onclick method in the aspx page, it works in IE. It seems to be only when I am building the link dynamically in the code behind. It will not accept any values as a parameter, and IE always outputs the error: SCRIPT87: Invalid argument with a line number to my function, however I am unable to debug. Have a missed something?

    Here is the html output:

    <td><a onclick="Myfunction('urlformyexample.com');" href="javascript:void(0);">Open Pop Up Window</a></td>
    
  • alexandru.topliceanu
    alexandru.topliceanu about 12 years
    ie9 does not like underscores nor dots in the window name. Sad!
  • nickb
    nickb almost 12 years
    +1. Turns out hyphens in the window name also break window.open() in IE9.
  • Robert Slaney
    Robert Slaney over 11 years
    developer tools... look at exception details