Chrome在新窗口中打开链接列表,而不是选项卡

Chrome opens list of links in new windows instead of tabs?

本文关键字:选项 在新窗口中打开 链接 列表 Chrome      更新时间:2023-09-26

我正在为自己建立一个自定义的开始页面,我遇到的一个问题是我想在所有部分上面有一个链接,当点击时,将在新选项卡中打开所有页面。我已经通过列表进行了解析,但只有第一个链接在新选项卡中打开,所有其他链接都在新窗中打开。

这是我正在做的页面的链接:
https://dl.dropboxusercontent.com/u/114859/code-experiments/start-tab.html

下面是一个示例节的HTML片段:

<section>
  <h2>Wallpaper Sites (<a href="#">open all</a>)</h2>
  <ul>
    <li><a href="http://wall.alphacoders.com/">Alpha Coders</a></li>
    <li><a href="http://interfacelift.com/">InterfaceLIFT</a></li>
    <li><a href="http://thepaperwall.com/">The Paper Wall</a></li>
  <ul>
</section>

这是JavaScript(主要是jQuery):

$( 'h2 a' ).on( 'click', function ( event ) {
  event.preventDefault();
  event.stopPropagation();
  $( this ).parent().next().find( 'a' ).each( function () {
    // console.log( this.href );
    window.open( this.href );
    window.focus();
  });
});

我不确定这种行为是否取决于您/用户的google chrome设置。