当我将鼠标悬停在 Chrome 中的某个网址上时,该网址会显示在 Chrome 状态栏中。在我的例子中,这导致了一个丑陋的 javascript:bla-bla-bla 引用。将鼠标悬停在链接上时,有什么方法可以更改状态栏的内容吗?
谢谢
最佳答案
虽然您选择了您的答案,但这个想法是另一种选择。
您可以在 mouseover
上更改 href
属性以影响状态栏显示的内容,并在 mouseout
或 上更改回来点击
:
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>
关于javascript - 更改 Chrome 状态栏中显示的 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6394506/