how do Google and Yahoo replace the URL in the browser status bar?

Posted by Mike W on Stack Overflow See other posts from Stack Overflow or by Mike W
Published on 2010-05-11T19:02:16Z Indexed on 2010/05/11 19:24 UTC
Read the original article Hit count: 219

Filed under:
|
|
|
|

On the Google and Yahoo search pages, the URLs of the 10 search result links actually point to google.com or yahoo.com. The URLs have extra arguments that allow google.com or yahoo.com to redirect to the actual search result when the link is clicked. When the user mouses over the link, the search result URL (and not the google.com or yahoo.com URL) is displayed in the browser's status bar.

I'm wondering how they do that.

Many years ago, this would have been accomplished by having some javascript that sets window.status, but that doesn't seem to work anymore, as is explained by http://stackoverflow.com/questions/876390/reliable-cross-browser-way-of-setting-status-bar-text

I have a link that looks like this: <a href="http://somedomain.com/ReallyLongURLThatShouldNotBeSeenInTheStatusBar" onmouseover="window.status='http://niceShourtUrl.com/'" onmouseout="window.status=''">Click Me</a>

This link tried to use the window.status strategy, but it doesn't work. How do I fix this link so that it acts like the links on Google's and Yahoo's search result pages? In this example, I want "http://niceShourtUrl.com/" to be displayed in the status bar when the user mouses over the link.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about statusbar