Friday, May 10, 2024
 Popular · Latest · Hot · Upcoming
74
rated 0 times [  78] [ 4]  / answers: 1 / hits: 20232  / 15 Years ago, wed, february 3, 2010, 12:00:00

I am using this chunk of jQuery/Javascript code on my site to open a popup window:



$('#change_photo_link').click(function(){
$id = $('#id').attr('value');

window.open(photo.upload.php?id= + $id,Upload Photo,
menubar=no,width=430,height=100,toolbar=no);
});


This code works on Firefox and Chrome. It does not work on IE7 or IE8 (haven't tested IE6).
IE pops up an error on the line window.open. Why? The error that IE gives is Invalid Argument and that's all.


More From » jquery

 Answers
8

It's the space in the second parameter that's causing it. If you use UploadPhoto instead of Upload Photo, it works:



$('#change_photo_link').click(function(){
$id = $('#id').attr('value');

window.open(photo.upload.php?id= + $id,UploadPhoto,
menubar=no,width=430,height=100,toolbar=no);
});


I can't seem to find any official reasons as to why having a space in the windowName parameter of window.open() causes an error, but it's likely just an implementation detail. The windowName is used as an internal reference, and can be used as a value for a target attribute of an anchor or form, so I guess IE can't handle that internally. The reference docs for Gecko/Firefox says that this parameter should not contain spaces, but clearly current versions of Gecko don't have a problem with it if it does.


[#97679] Saturday, January 30, 2010, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
mckenna

Total Points: 445
Total Questions: 109
Total Answers: 109

Location: Virgin Islands (U.S.)
Member since Sun, May 16, 2021
3 Years ago
;