当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - IE not opening window properly

问题描述:

So I did

 $('a.class').click(function(e){

newWindow = window.open(link.attr('href'), 'name', "height=600,width=1000");

e.preventDefault();

});

But in IE it didn't open a new window, it uses the same window and it follows the link in the same window instead of doing nothing in the window and then open the link in a new window...

What should I do to make it open the link in a new window in IE (works in firefox, chrome)

网友答案:

Not sure but i think link.attr('href') is not working as expected, replace with jQuery(this).attr('href') keyword.

newWindow = window.open(jQuery(this).attr('href'), 'name', "height=600,width=1000");
网友答案:

try adding this to your link

target="_blank"

you can also add it with Jquery.

分享给朋友:
您可能感兴趣的文章:
随机阅读: