Search code examples
javascriptprototypejsdom-events

Window.open working in all the browser except IE, when I hit the link, getting an error Invalid argument


It's working in all the browsers except IE, when I hit the link, getting an error:

Invalid argument

HTML File...

<a href="javascript:void(0);" id="link">Open new window</a>

JS File...

$("link").observe("click", function () {
    window.open(location.protocol + "//" + location.host + "/" + "location.html", "Help desk", "width=643,height=600,resizable=1,toolbar=1,scrollbars=1,left=200");
});

Why is it not working in IE?


Solution

  • IE only supports a limited subset of names for the window and "Help Desk" is not one of them. Changing that argument to "_blank" will fix your issue.