简体   繁体   English

使用target ='name'时如何切换浏览器选项卡?

[英]How to switch browser tabs when using target='name'?

I am developing a site which has a glossary ( /glossary#item-name ). 我正在开发一个具有词汇表( /glossary#item-name )的网站。 So far I have been linking to it like this: <a href="/glossary#item-name" target="glossary">item</a> , but I realised that although it opens and switches to the 'glossary' tab when you click the first link, it then does not switch to the glossary tab when you click other links - it simply reloads it (and jumps to whatever anchor is set). 到目前为止,我一直在像这样链接它: <a href="/glossary#item-name" target="glossary">item</a> ,但是我意识到尽管它打开并切换到“ glossary”标签当您单击第一个链接时,当您单击其他链接时,它不会切换到词汇表选项卡-只是重新加载它(并跳转到设置的锚点)。

What can I do to force the browser to switch tabs? 如何强制浏览器切换标签? I don't want to use target="_blank" because every time you click on a link it opens a new tab, which is a pain for the user, but is this all I can do? 我不想使用target="_blank"因为每次您单击链接时,它都会打开一个新选项卡,这对用户来说很痛苦,但这是我能做的吗? I am on Chrome 30.0 and am building the site using Bootstrap R3, jQuery and PHP if it helps. 我使用的是Chrome 30.0,如果有帮助,可以使用Bootstrap R3,jQuery和PHP构建网站。

Thanks in advance! 提前致谢!

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

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