[英]Javascript Event for “Open in new Tab”
I have the following problem: I use Javascript onclick event to change href of a link.我有以下问题:我使用 Javascript onclick 事件来更改链接的 href。 It works like a charm but only if user just clicks a link.
它就像一个魅力,但前提是用户只需点击一个链接。 If "Open in new tab" feature is used for the link - onclick event will not fire and href will never change.
如果“在新标签页中打开”功能用于链接 - onclick 事件不会触发并且 href 永远不会改变。 Is there any way to handle such an event?
有没有办法处理这样的事件? Perhaps with jQuery or some other JS Framework?
也许使用 jQuery 或其他一些 JS 框架?
Example:例子:
<a href="some_url" onclick="this.href = 'some_other_url'">Link</a>
Try to change尝试改变
<a href="some_url" onclick="this.href = 'some_other_url'">Link</a>
to到
<a href="some_url" onmousedown="this.href = 'some_other_url'">Link</a>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.