在新选项卡中打开链接,仅在新选项卡中打开链接 [英] Opening links in a new tab and only the new tab

查看:147
本文介绍了在新选项卡中打开链接,仅在新选项卡中打开链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要打开一个新标签页或弹出窗口,然后在任何其他时间单击原始源链接时,它会更新已打开的标签页或窗口。现在它只是不断打开一个新的标签页,这不是预期的行为。 指定一个自定义的目标名称:

 < a href =something.htmltarget =otherpage >转到某个页面#1< / a> 

这将命名另一个窗口/选项卡并使用相同的目标,或者在新的窗口/选项卡中(如果尚不存在)。您可以通过将名称指定为第二个参数来实现与 window.open 相同的效果。


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:

<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. You can achieve the same effect with window.open by specifying the name as the second argument.

这篇关于在新选项卡中打开链接,仅在新选项卡中打开链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆