繁体   English   中英

隐藏鼠标悬停链接的URL

[英]Hide URL of mouse overing link

更新


我终于找到了一种简单的方法:

 <font onclick="window.open('https://www.google.pt/', '_self');" style="background:0;border:0;outline:0">Link 

我必须使用标签将事件添加到文本,所以我使用了font因为它不会进行任何修改。 PS:这在JS Fiddle上不起作用,因为某种原因,它无法打开链接(保持空白)。


可能是重复的,但我找不到它,当我将鼠标移到链接的URL上时,有什么方法可以阻止该链接的URL显示吗? 带有网址图片的代码:

 <a href="https://www.google.pt/">Google</a> <br> When I over the mouse on the link, it shows the URL on the bottom left corner. <br> <img src="http://i.imgur.com/pq3ket7.png"> <br> Is there any way to prevent it? I'm using Chrome. 

https://jsfiddle.net/1tbg478j/

这是不受控制的浏览器行为。
您可以将其转换为div,将click事件侦听器附加到回调函数中打开所需的URL。

JSFiddle坏了,所以我将所有代码粘贴到这里。 请注意,这些链接在JSFiddle中不起作用,因为它们不允许window.location,但可以在您的网站中使用。

HTML:

<a class="no-href" data-location="https://www.google.pt">Google</a><br />
<a class="no-href" data-location="https://www.google.com">Link 2</a><br />
<a class="no-href" data-location="https://www.google.co.za">Link 3</a><br />
<a href="https://www.google.pt/">Normal Link</a><br />
<br>
When I over the mouse on the link, it shows the URL on the bottom left corner.
<br>
<img src="http://i.imgur.com/pq3ket7.png">
<br>
Is there any way to prevent it?
I'm using Chrome.

JS:

$('.no-href').click(function(e){
    e.preventDefault();
    window.location = $(this).attr('data-location');
});

CSS:

.no-href {
  color: blue;
  cursor: pointer;
  text-decoration: underline;
}

只需像这样将其添加到OnClick:

<a href="javascript:;" onclick="location.href='https://www.google.pt/'">Google</a>

希望对您有帮助。

据此,它不能完成: https : //productforums.google.com/forum/?hl= zh-CN#!category- topic/ chrome/discuss-chrome/ FtD7qjochgw

暂无
暂无

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

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