更改 Chrome 状态栏中显示的 URL

发布于 2024-11-15 22:31:57 字数 132 浏览 4 评论 0原文

当我将鼠标悬停在 Chrome 中的某个网址上时,该网址会显示在 Chrome 状态栏中。就我而言,这会导致丑陋的 javascript:bla-bla-bla 引用。当您将鼠标悬停在链接上时,有什么方法可以更改状态栏的内容吗?

谢谢

When I hover over a url in Chrome, the url is displayed in the Chrome status bar. In my case this results in an ugly javascript:bla-bla-bla reference. Is there any way to change the contents of the status bar when you hover over a link?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

痴意少年 2024-11-22 22:31:57

尽管您选择了答案,但这个想法是另一种选择。

您可以更改 mouseover 上的 href 属性来影响状态栏的显示内容,然后在 mouseoutclick 上将其更改回来代码>:

function showNiceLink(el, e) {
  e = e || event;
  el.originalHref = el.originalHref || el.href;
  console.log(e.type);

  if (/click|out/i.test(e.type)){
    el.href = el.originalHref;
  } else {
    el.href = "http://Linking...";
  }
}
<a href="#this is a really UGLY link @1##$%!!&"
   onmouseover="showNiceLink(this,event)"
   onmouseout="showNiceLink(this,event)"
   onclick="showNiceLink(this,event)">a link with an ugly <code>href</code></a>

Although you selected your answer, this idea is an alternative.

You can change the href attribute on mouseover to affect what the status bar says, and change it back on mouseout or click:

function showNiceLink(el, e) {
  e = e || event;
  el.originalHref = el.originalHref || el.href;
  console.log(e.type);

  if (/click|out/i.test(e.type)){
    el.href = el.originalHref;
  } else {
    el.href = "http://Linking...";
  }
}
<a href="#this is a really UGLY link @1##$%!!&"
   onmouseover="showNiceLink(this,event)"
   onmouseout="showNiceLink(this,event)"
   onclick="showNiceLink(this,event)">a link with an ugly <code>href</code></a>

在巴黎塔顶看东京樱花 2024-11-22 22:31:57

我很确定出于安全原因这在任何浏览器中都是不可能的。否则,钓鱼网站的链接将变得非常非常难以检测,因为攻击者只需在状态栏中放置一个真实的 URL,而危险链接实际上会指向其他地方...

请为您的超链接使用 onclick 事件处理程序,并放置一个href 属性中真实、有意义的 URL 代替 javascript: 链接(即使该链接仅用于 JavaScript)。

I'm pretty sure for security reasons this isn't possible in any browser. Otherwise links to phishing sites will become much, much harder to detect, because attackers can then just place a genuine URL in the status bar while the dangerous link actually leads elsewhere...

Use an onclick event handler for your hyperlink instead, and put a real, meaningful URL in the href attribute in place of the javascript: link (even if the link is meant to be used only with JavaScript).

翻了热茶 2024-11-22 22:31:57
<a href="#" onClick="yourFunc(); return false;">Your "link"</a>
<a href="#" onClick="yourFunc(); return false;">Your "link"</a>
神经大条 2024-11-22 22:31:57

我猜您的意思是您想要更改所选链接显示的目的地?在这种情况下,您很可能应该在 href 属性中放置漂亮的 url,并为您的 javascript 使用 onclick 属性。不确定是否可以通过将 javascritp 放入 href 来复制所做的一切。

I guess you mean you want to change what destination is shown for link that is selected? In that case you most likely should put nice url in href attribute, and use onclick attribute for your javascript. Not sure that you can duplicate everything what is done by putting javascritp in href.

平生欢 2024-11-22 22:31:57

Assuming this is what you have:
<a onClick="blabla">Link</a>
Add href="#" to it. Then the # should be shown in stead of the javascript:blabla.
So that would be like this:
<a href="#" onClick="blabla">Link</a>

独自唱情﹋歌 2024-11-22 22:31:57

绝对可以达到想要的效果。只要看看谷歌在其搜索结果状态栏中显示的内容即可。

但是,您需要使用某种技巧,例如像 BoltClock 建议的 onclick

Google 会向您显示您希望看到的内容 - 一个简单、干净的 URL。
然而,在下面,他们使用带有监控参数的长重定向 URL,在您单击任何结果链接时跟踪您。通过这种方式,谷歌可以监控哪些搜索结果被点击,哪些没有被点击。

不幸的是,大多数人没有意识到这一点。坦白说,我很高兴看到一个浏览器扩展能够消除所有这些肮脏的伎俩,并用“真​​实的”URL 替换“跟踪”URL。

It is definitely possible to achieve the desired effect. Just look at what Google puts in the status bar of its search results.

However, you need to use some kind of a trick, e.g. onclick like BoltClock suggested.

Google shows you what you would like to see - a plain, clean URL.
Underneath, however, they use a long redirect URL with monitoring parameters to track you down as you click any result link. That way Google monitors which of the search results are clicked on and which are not.

Unfortunately, most people do not realize that. Quite frankly, I would be very glad to see a browser extension which takes all this dirty tricks down and replaces "tracking" URLs with the "real ones".

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文