开发者

Window.open not working in Internet Explorer [duplicate]

开发者 https://www.devze.com 2023-02-20 11:34 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicates: window.open not working in IE
This question already has answers here: Closed 11 years ago.

Possible Duplicates:

window.open not working in IE

Javascript “window.open” code won't work in Internet Explorer 7 or 8

I have a global detector detecting when someone clicks on an image inside of a <div> of class Gallery like below:

$('.Gallery a').click(function(eve开发者_如何学编程nt) {
        event.preventDefault();
        window.open ($(this).attr('href'),"Gallery Image","menubar=1,resizable=1,width=500,height=600");
    });

The event.preventDefault() is working, so when they click on the image nothing happens. However, in Internet Explorer no window opens. Any ideas why, or do you know a better way of doing this?

In Firefox / Chrome it works perfectly.


You can't have spaces in the window name in IE, and in fact it only "works" in Firefox/Chrome by fluke: it's not compliant to try to use them.

Note that "name" is not the same as "title" or "caption"; the name should be some programmatic ID like "galleryWindow"; it's not a message that gets displayed to a user anywhere.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号