Sunday, May 19, 2024
75
rated 0 times [  81] [ 6]  / answers: 1 / hits: 117750  / 15 Years ago, thu, april 2, 2009, 12:00:00

I have a site that has an IE8-only problem:



The code is:



var w = window.open(urlstring, wname, wfeatures, 'false');


The error is:




Message: Invalid argument.

Line: 419
Char: 5

Code: 0

URI: http://HOSTNAME/js_context.js




I have confirmed the line number of the code (the Line and URI are correct), and I understand in later versions of IE8, this is considered accurate.



I have checked all the incoming parameters in the call by dumping alerts, and they all look valid.



This problem does not happen on FF (probably 3).



UPDATE:



The problem appears to be in using assigning the result of window.open() when doing var w. When I split the line into two statements it works in IE8.



UPDATE2:



Based on:



http://javascript.crockford.com/code.html




When a function is to be invoked
immediately, the entire invocation
expression should be wrapped in parens
so that it is clear that the value
being produced is the result of the
function and not the function itself.




This is not exactly what is going on here, but I found that applying the principle solved the problem, in IE8's compatability mode.



var w = (window.open(urlstring, wname, wfeatures, false));

More From » internet-explorer-8

 Answers
5

This is an old posting but maybe still useful for someone.



I had the same error message. In the end the problem was an invalid name for the second argument, i.e., I had a line like:



   window.open('/somefile.html', 'a window title', 'width=300');


The problem was 'a window title' as it is not valid. It worked fine with the following line:



   window.open('/somefile.html', '', 'width=300');


In fact, reading carefully I realized that Microsoft does not support a name as second argument. When you look at the official documentation page, you see that Microsoft only allows the following arguments, If using that argument at all:




  • _blank

  • _media

  • _parent

  • _search

  • _self

  • _top


[#99757] Saturday, March 28, 2009, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
deonkalvinw

Total Points: 409
Total Questions: 96
Total Answers: 89

Location: Saint Pierre and Miquelon
Member since Sun, Nov 27, 2022
2 Years ago
deonkalvinw questions
Sun, Feb 6, 22, 00:00, 2 Years ago
Tue, Dec 28, 21, 00:00, 2 Years ago
Sun, Aug 22, 21, 00:00, 3 Years ago
Sun, Mar 7, 21, 00:00, 3 Years ago
;