For one reason or another, you may want to hide the URL displayed in the browser window’s status bar when a user mouses over it.
The URL can be easily hidden by using some simple HTML and JavaScript with a few basic techniques.
Hiding the URL With HTML and JavaScript using Void(0)
This code will display some JavaScript code in the status bar instead of the URL and will still work as a normal link when clicked.
<a href="javascript:void(0)" onclick="location.href='https://actualwizard.com'">Mousing over this URL will display "void(0)" in the browser's status bar.</a>
Code Demo:
Mousing over this URL will display “void(0)” in the browser’s status bar.
Hiding the URL in the Browser Status Bar with the Pound Symbol
Note: This technique is a little bit deceptive, and using it should be avoided.
The URL displayed in the status bar will appear to be the current URL followed by the pound (#) symbol, but when the user clicks it, they will be taken to whatever URL is specified in the JavaScript.
<a href="#" onclick="location.href='https://actualwizard.com'">Mousing over this URL will display the current URL followed by a pound symbol.</a>
Code Demo:
Mousing over this URL will display the current URL followed by a pound symbol.
The Old Techniques Using window.status
There used to be a more eloquent way to achieve this by using window.status, but most major web browsers have long disabled the ability to hide the URL in the status bar this way due to security problems.
Web developers could set the status bar text to anything they wanted at any time, but this was problematic because people could be misled into thinking that they were clicking on a link to one site but were being taken to a different site.