簡體   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