简体   繁体   English

隐藏鼠标悬停链接的URL

[英]Hide URL of mouse overing link

UPDATE 更新


I finally found a simple and easy way: 我终于找到了一种简单的方法:

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

I had to use a tag to add the event to the text so I used font because it doesn't modify anything. 我必须使用标签将事件添加到文本,所以我使用了font因为它不会进行任何修改。 PS: This doesn't work on JS Fiddle as, for some reason, it doesn't open the link (it stays blank). PS:这在JS Fiddle上不起作用,因为某种原因,它无法打开链接(保持空白)。


Probably duplicated but I couldn't find it so, is there any way to prevent the URL of a link to show when I move my mouse over it? 可能是重复的,但我找不到它,当我将鼠标移到链接的URL上时,有什么方法可以阻止该链接的URL显示吗? Code with image of the 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/ https://jsfiddle.net/1tbg478j/

It's uncontrolled browser behavior. 这是不受控制的浏览器行为。
You can convert it to a div, attach a click event listener an open the wanted url in the callback function. 您可以将其转换为div,将click事件侦听器附加到回调函数中打开所需的URL。

The JSFiddle broke so I will just paste all the code here. JSFiddle坏了,所以我将所有代码粘贴到这里。 Please note that the links won't work in JSFiddle because they do not allow window.location but it will work in your website. 请注意,这些链接在JSFiddle中不起作用,因为它们不允许window.location,但可以在您的网站中使用。

HTML: 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: JS:

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

CSS: CSS:

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

Simply add it to OnClick like this: 只需像这样将其添加到OnClick:

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

Hope it helps you. 希望对您有帮助。

据此,它不能完成: 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