The Usual Client The Usual Client - 6 months ago 28
HTML Question

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.

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?
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/

Answer

The JSFiddle broke so I will just paste all the code here. Please note that the links won't work in JSFiddle because they do not allow window.location but it will work in your website.

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;
}