0

I am using the following function in my code

function viewTearSheet(creativeId) {
    var url = "/Main?event_key=new_view_test_ad&isAjaxCall=true&fromCreateAdNewDesign=tear&"+"&creativeId=" + creativeId + "&testAdClick=primary";
    day = new Date();
    id = day.getTime();
    window.open(url, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=1000,height=800,left = 320,top = 150');
}

It works for all the browsers except IE8.It give following error message in IE8

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0;
.NET CLR 2.0.50727; .NET4.0C; .NET4.0E)
Timestamp: Wed, 6 Feb 2013 07:06:38 UTC

Message: Invalid argument.
Line: 497
Char: 5
Code: 0
URI: https://test.juhu.abc.com/chakra/campaign/view.js?z=166

How can I resolve this..Thanks in advance..

Bergi
  • 630,263
  • 148
  • 957
  • 1,375
milind
  • 269
  • 5
  • 7
  • 16

2 Answers2

1

The string '" + id + "' is no valid window name - spaces and plus signs are not allowed, I and strongly doubt quotes are. See also ie8 var w= window.open() - "Message: Invalid argument.", window.open throws invalid argument in IE7-8-9b and window.open invalid argument error

Community
  • 1
  • 1
Bergi
  • 630,263
  • 148
  • 957
  • 1,375
  • yes. change this `(url, '" + id + "', 'tool...` to that `(url, 'win' + creativeId, 'tool...` –  Feb 06 '13 at 09:22
0

Could be a red herring but in your code here you have multiple & symbols and an un needed + any reason for this try removing it as it couldbe the issue.

Instead off this

 var url = "/Main?event_key=new_view_test_ad&isAjaxCall=true&fromCreateAdNewDesign=tear&"+"&creativeId=" + creativeId + "&testAdClick=primary";

Ty this

var url = "/Main?event_key=new_view_test_ad&isAjaxCall=true&fromCreateAdNewDesign=tear&creativeId=" + creativeId + "&testAdClick=primary";

Also only normal charachters are allowed in window name so if your date is formated with - etc this will also break in ie 8, try replacing id with a normal string and see if the issue still happens. if so then that's your problem.

See Bergi's answer for more info

Dominic Green
  • 10,142
  • 4
  • 30
  • 34