简体   繁体   English

在新标签页中仅打开新标签页中的链接

[英]Opening links in a new tab and only the new tab

I need to open a new tab or popup window, and then any other time the original source link is clicked, it updates the already open tab or window. 我需要打开一个新的选项卡或弹出窗口,然后在其他任何时候单击原始源链接,它都会更新已经打开的选项卡或窗口。 Right now it just keeps opening a new tab and that's not the behavior that's expected. 现在,它只是继续打开一个新标签,这不是预期的行为。

Specify a custom target name: 指定自定义target名称:

<a href="something.html" target="otherpage">Go to some page #1</a>
<a href="something2.html" target="otherpage">Go to some page #2</a>

This will "name" the other window/tab and open links with the same target in that page, or in a new window/tab if one doesn't already exist. 这将“命名”另一个窗口/选项卡,并在该页面或新窗口/选项卡(如果不存在)中打开具有相同target链接。 You can achieve the same effect with window.open by specifying the name as the second argument. 通过将名称指定为第二个参数,可以使用window.open达到相同的效果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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