Google和Yahoo如何替换浏览器状态栏中的URL? [英] How do Google and Yahoo replace the URL in the browser status bar?

查看:180
本文介绍了Google和Yahoo如何替换浏览器状态栏中的URL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Google和Yahoo搜索页面上,10个搜索结果链接的网址实际上指向google.com或yahoo.com。 URL具有额外的参数,允许google.com或yahoo.com在单击链接时重定向到实际搜索结果。当用户将鼠标悬停在链接上时,搜索结果网址(而不是google.com或yahoo.com网址)会显示在浏览器的状态栏中。

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.

很多年前,这可以通过设置一些设置window.status的javascript来实现,但这似乎不再适用了,如可靠的跨浏览器设置状态栏文字的方式所解释

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 Reliable cross browser way of setting Status bar text

我的链接如下所示:
< a href =http:// somedomain。 com / ReallyLongURLThatShouldNotBeSeenInStatusBaronmouseover =window.status ='http://niceShourtUrl.com/'onmouseout =window.status =''>点击我< / a>

此链接尝试使用window.status策略,但它不起作用。如何修复此链接,使其像Google和Yahoo搜索结果页面上的链接一样?在这个例子中,我希望 http://niceShourtUrl.com/ 显示在状态栏中用户将鼠标悬停在链接上。

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.

推荐答案

很难阅读来源,但你会看到实际上的URL(在< a> 标记)是正确的目标网址,这就是浏览器状态栏显示正确网址的原因(而不是您实际重定向的跟踪链接)点击)。然后有一些 onclick JavaScript,然后可以在浏览器的默认操作(链接之后)之前拦截点击。

It's hard to read the source, but you will see that in fact the URLs (in the <a> tags) are the correct destination URLs, which is why the browser's status bar shows the correct URL (instead of the tracking link that it redirects you through when you actually click). There is then some onclick JavaScript that can then intercept the clicks before the browser's default action (following the link) can take place.

这篇关于Google和Yahoo如何替换浏览器状态栏中的URL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆