简体   繁体   中英

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)

try adding this to your link

target="_blank"

you can also add it with Jquery.

不确定,但我认为link.attr('href')不能按预期工作,请替换为jQuery(this).attr('href')关键字。

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM