1

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.      P.S.: This doesn't work on JS Fiddle as, for some reason, it doesn't open the link (it stays blank).


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/

  • 1
    Possible duplicate of [how can url be hidden in hyperlink when mouse hover](http://stackoverflow.com/questions/9851372/how-can-url-be-hidden-in-hyperlink-when-mouse-hover) – Patrick Evans Jun 01 '16 at 12:50
  • Theres no way to do this reliable in every browser. Aswell there should **NEVER** be the need to do that - why do you wanna do that? - You can use javascript if you don't want to show where the link goes. => `onMouseOver="window.status = ''"` – Xatenev Jun 01 '16 at 12:50
  • @PatrickEvans I think the solution is on the 1st answer of that link. It's not exactly but it's a trick, a way around it. – The Usual Client Jun 01 '16 at 12:55
  • 1
    @Xatenev You say it should NEVER be done, however, even here on the site, the "Add Comment" button does that (doesn't show any URL but works like a link). – The Usual Client Jun 01 '16 at 12:56
  • @TheUsualClient, maybe in Firefox, but in Chrome if you hover over "add comment" you get `...-overing-link#` in the status bar. – Patrick Evans Jun 01 '16 at 12:58

4 Answers4

0

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.

Sharon Haim Pour
  • 6,595
  • 12
  • 42
  • 64
0

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;
}
Chris
  • 987
  • 6
  • 24
0

Simply add it to OnClick like this:

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

Hope it helps you.

Nestoraj
  • 722
  • 2
  • 6
  • 19
-1

According to this it cant be done : https://productforums.google.com/forum/?hl=en#!category-topic/chrome/discuss-chrome/FtD7qjochgw

CHS
  • 173
  • 1
  • 1
  • 8