如何在浏览器状态栏中显示文字?

发布于 2024-08-05 01:57:00 字数 49 浏览 11 评论 0 原文

我们如何使用 JavaScript(或 jQuery)更改浏览器状态栏中显示的文本?

How can we change the text displayed in the browser status bar using JavaScript (or jQuery)?

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

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

发布评论

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

评论(6

辞旧 2024-08-12 01:57:00

这是可以做到的。 Google 搜索正在执行此操作,当您将鼠标悬停在 Google 链接上时可以看到,状态栏显示底层站点:

在此处输入图像描述

然而,当您单击它时,它会将您带到一个依赖于用户代理的位置网址类似于 https://www.google. com.sg/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0CC8QFjAAahUKEwi4lP-Z4_rIAhVLk5QKHXRLAe8&url=https%3A%2F%2Fwww.example.com% 2F&usg=AFQjCNFEbIRqDC65KFpmuak0aXKmnzjKVQ&bvm=bv.106923889,d.dGo。该网址在将您重定向到 https://www.example.com 之前会进行 Google 跟踪等操作。您可以使用 Network Inspector 和“保留日志”轻松测试这一点。

他们使用的是hacky hack,但它适用于所有浏览器

诀窍是要认识到我们可以仅使用 HTLM 的 a href (不需要 CSS 或 JavaScript)将状态栏设置为几乎任何内容。我们所需要的只是欺骗浏览器的解析器,使其认为 href 值是有效的 url,然后它将显示它。

尝试运行这个片段:

<a href="http://.# this is p͕͓͔͕͓͔͕͓͔͕͓͔͕͓͔͕͓͔͕͓͔͕͓͔͕͓͔͕͓͔͕͓͔̐̑̓̐̑̓̐̑̓̐̑̓̐̑̓̐̑̓̐̑̓̐̑̓̐̑̓̐̑̓̐̑̓̐͜͜͜͜͜͜͜͜͜͜͜͜‌​̴̵̶͕͓͔͕͓͔͕͓͔͕͓͔̖͕͓̖̱̲̳̖̖̖̖̖̖̖͕̑̓̐̑̓̐̑̓̐̑̓̑̒̓̔̐̒̓̔̒̓̔̒̓̔̒̓̔̒̓̔̒̓̔̒̓̔̒̓̔̒̓̔̐̕̚͜͜͜͜͜‌​͓͔̖͕͓͔̖͕͓͔̖͕͓͔̖͕͓͔̖͕͓͔̖̑̓̑̒̓̔̐̑̓̑̒̓̔̐̑̓̑̒̓̔̐̑̓̑̒̓̔̐̑̓̑̒̓̔̐̑̓̑̒̓̔̕̚̕̚̕̚̕̚̕̚̕̚͜͜͜͜͜‌​͕͓͔̖͕͓͔̖̐̑̓̑̒̓̔̐̑̓̓̓̓̓̓̓̑̒̓̔̕̚̕̚͜͜owerful because ━Σ(゚Д゚|||)━ symbols !@)(*#&$^%</even htlm> or lorem ipsum in all scripts Лорем ипсум Lorem存有 ငါ့ရဲ့ဇာတ်မြင့် घरՏուն Дома ലോറെൻ  ഇപ്സം درமுகப்புЛорем ипсумలోלורם איפסוםరెం ఇప్సమ్ მთავარი હોમ לורם איפסוםלורם איפסום Forsíða Loremのイプサム ಮುಖಪುಟ ទំព័រដើម 가 lorem ipsum의 ຫນ້າທໍາອິດ Տուն আর্কাইভ">Hover this link (do not click) and observe the browser's status bar.</a>

Chrome 的输出(点击图片最大化):(v46.0.2490.80 m)

在此处输入图像描述

FireFox 的输出:(v42.0)

在此处输入图像描述

IE 的输出:(v11.0.9600.17905 更新版本11.0.21 (KB3065822))

在此处输入图像描述

Opera 的输出:(v33.0.1990.58 stable)

在此处输入图像描述

Seamonkey 的输出:(v2.38)

在此处输入图像描述

Avant 的输出: (v Ultimate 2015 build 28)

  • IE 11 引擎:

    在此处输入图像描述

  • IE 兼容引擎:

    在此处输入图像描述

  • Chrome 引擎:

    在此处输入图像描述

  • FireFox 引擎:

    在此处输入图像描述

Torch 的输出:(v42.0.0.10546)

在此处输入图片描述

百度的输出:(v43.19.1000.119 )

输入图片此处描述

Maxthon 的输出:(v4.4.8.1000)

在此处输入图像描述


另外,不必使用 #片段标识符)。浏览器也会将像 http://some.message.here./and_more_message_here 这样的文本视为有效的 URL。根据浏览器的不同,更奇怪的字符串可能被认为是有效的:

  1. (Chrome、FireFox、IE、SM、Torch、百度、Maxthon、Avant IE11、Avant IE Compat、Avant Chrome、Avant Firefox。)

    (对于具有预期输出的浏览器,会列出名称;对于没有状态栏输出的浏览器,名称会带有删除线(“example”);对于具有意外输出的浏览器,名称会带有下划线(“e̲x̲a̲m̲p̲l̲e̲”) /行为。使用与上面列出的浏览器版本相同的版本进行测试。)

  2. (Chrome、FireFox、I̲E̲、SM、火炬、B̲a̲i̲d̲u̲、M̲a̲x̲t̲h̲o̲n̲、A̲v̲a̲n̲t̲ I̲E̲ ̲1̲1̲、A̲v̲a̲n̲t̲ I̲E̲ ̲C̲o̲m ̲p̲a̲t̲、Avant Chrome、Avant Firefox。)

  3. < a href="http://测试域部分/a_b_c_d_e中的一些.空格">

    (C̲h̲r̲o̲m̲e̲、FireFox、I̲E̲、SM、T̲o̲r̲c̲h̲、B̲a̲i̲d̲u̲、M̲a̲x̲t̲h̲o̲n̲、A̲v̲a̲n̲t̲I̲E ̲1̲1̲、A̲v̲a̲n̲t̲ I̲E̲ ̲C̲o̲m̲p̲a̲t̲、A̲v̲a̲n̲t̲ C̲h̲r̲o̲m̲e̲、Avant Firefox)

  4. (C̲h̲r̲o̲m̲e̲、FireFox、I̲E̲、SM、T̲o̲r̲c̲h̲、B̲a̲i̲d̲u̲、M̲a̲x̲t̲h̲o̲n̲、A̲v̲a̲n̲t̲I̲E ̲1̲1̲、A̲v̲a̲n̲t̲ I̲E̲ ̲C̲o̲m̲p̲a̲t̲、A̲v̲a̲n̲t̲ C̲h̲r̲o̲m̲e̲、Avant Firefox)

  5. (Chrome、FireFox、IE、SM、Torch、百度、Maxthon、Avant IE11、Avant IE Compat、Avant Chrome、Avant Firefox)

  6. (ChromeFireFoxIESM火炬、< s>百度、傲游Avant IE11、A̲v̲a̲n̲t̲ I̲E̲ ̲C̲o̲m̲p̲a̲t̲、Avant ChromeAvant Firefox )

  7. < a href="http://test @ with space">

    (C̲h̲r̲o̲m̲e̲、FireFoxIESM、T̲o̲r̲c̲h̲、B̲a̲i̲d̲u̲、M̲a̲x̲t̲h̲o̲n̲、A̲v̲a̲n̲t̲ I̲E ̲ ̲1̲1̲、A̲v̲a̲n̲t̲ I̲E̲ ̲C̲o̲m̲p̲a̲t̲、A̲v̲a̲n̲t̲ C̲h̲r̲o̲m̲e̲、 Avant Firefox)

  8. (C̲h̲r̲o̲m̲e̲、FireFoxIESM、T̲o̲r̲c̲h̲、B̲a̲i̲d̲u̲、M̲a̲x̲t̲h̲o̲n̲、A̲v̲a̲n̲t̲ I̲E ̲ ̲1̲1̲、A̲v̲a̲n̲t̲ I̲E̲ ̲C̲o̲m̲p̲a̲t̲、A̲v̲a̲n̲t̲ C̲h̲r̲o̲m̲e̲、 Avant Firefox)

  9. (C̲h̲r̲o̲m̲e̲、FireFox、IE、SM、T̲o̲r̲c̲h̲、B̲a̲i̲d̲u̲、M̲a̲x̲t̲h̲o̲n̲、A̲v̲a̲n̲t̲ I̲E̲̲1̲1̲、A ̲v̲a̲n̲t̲ I̲E̲ ̲C̲o̲m̲p̲a̲t̲、A̲v̲a̲n̲t̲ C̲h̲r̲o̲m̲e̲、Avant Firefox)

  10. [电子邮件受保护]">

    (C̲h̲r̲o̲m̲e̲、FireFox、IE、SM、T̲o̲r̲c̲h̲、B̲a̲i̲d̲u̲、傲游、A̲v̲a̲n̲t̲ I̲E̲ ̲1̲1̲、A̲v̲a̲n̲t̲ I̲E ̲ ̲C̲o̲m̲p̲a̲t̲、A̲v̲a̲n̲t̲ C̲h̲r̲o̲m̲e̲、Avant Firefox)

  11. 重复上面的所有测试字符串,将 http:// 替换为 https://ftp://about://chrome://file://foobar://

我们可以看到,如果浏览器没有考虑该字符串是一个有效的 url,它将通过不显示状态栏来优雅地失败,因此不会造成任何损害。 (除了看起来 Avant IE Compat 与测试字符串 "http://abc:port_with_letters_test" 存在一些错误。)


让浏览器状态栏显示我们想要的字符串只是第一步。第二步是当用户单击链接时阻止浏览器加载页面。

使用 return false 可以轻松完成此操作:

<a onclick="return false" href="http://some.message.here./and_more_message_here">this link will not load</a>

或者:

<a onclick="return f()" href="http://some.message.here./and_more_message_here">this link will not load</a>
<script>
  function f() {
    return false;
  }
</script>

以上两个代码片段经过测试,可在 Chrome、FireFox、IE、SM、Torch、百度、Maxthon、Avant IE11、Avant IE Compat、Avant Chrome、Avant Firefox 上运行。


最后一步是使用 window.locationwindow.open 模仿 a href 的行为。它可以内联完成:(在线测试)

<!doctype html>
<a onclick="location='http://example.org'; return false" href="https://some.message.here./and_more_message_here">same tab</a>
<br><a onclick="window.open('http://example.org'); return false" href="https://some.message.here./and_more_message_here">new tab</a>


或使用return func() :(在线测试

<!doctype html>
<a onclick="return f1()" href="http://some.message.here./and_more_message_here">same tab 2</a>
<br><a onclick="return f2()" href="http://some.message.here./and_more_message_here">new tab 2</a>
<script>
  function f1() {
    location = 'http://example.org';
    return false;
  }

  function f2() {
    open('http://example.org');
    return false;
  }
</script>

或内联setTimeout: (在线测试)

<!doctype html>
<a onclick="setTimeout(function(){location='http://example.org';},1); return false" href="https://some.message.here./and_more_message_here">same tab 3</a>
<br><a onclick="setTimeout(function(){window.open('http://example.org');},1); return false" href="http://some.message.here./and_more_message_here">new tab 3 (doesn't work on Avant IE11 and Avant IE Compat if this link is HTTP; works if it is HTTPS or FTP)</a> 


或者使用return func() with setTimeout: (在线测试)

<!doctype html>
<a onclick="return f1()" href="http://some.message.here./and_more_message_here">same tab 4</a>
<br><a onclick="return f2()" href="http://some.message.here./and_more_message_here">new tab 4 (doesn't work on Avant IE11 and Avant IE Compat if this link is HTTP; works if it is HTTPS or FTP)</a> <!-- hadn't tested this with sourcepage=HTTP. only tested with sourcepage=HTTPS and sourcepage=localwebpage -->
<script>
  function f1() {
    setTimeout(function() {
      location = 'http://example.org';
    }, 1);
    return false;
  }

  function f2() {
    setTimeout(function() {
      open('http://example.org');
    }, 1);
    return false;
  }
</script>

以上两个片段也是经测试可在 Chrome、FireFox、IE、SM、Torch、百度、Maxthon、Avant IE11(代码中注明警告)、Avant IE Compat(代码中注明警告)、Avant Chrome、Avant Firefox 上运行。

This can be done. Google Search is doing it, which can be seen when you hover over a Google link, the status bar shows the underlying site:

enter image description here

Yet when you click it, it brings you to a location and user-agent dependent url that looks like https://www.google.com.sg/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0CC8QFjAAahUKEwi4lP-Z4_rIAhVLk5QKHXRLAe8&url=https%3A%2F%2Fwww.example.com%2F&usg=AFQjCNFEbIRqDC65KFpmuak0aXKmnzjKVQ&bvm=bv.106923889,d.dGo. The url does Google tracking and whatnot before redirecting you to https://www.example.com. You can easily test this using Network Inspector with "preserve log".

They're using a hacky hack but it works across all browsers.

The trick is to realize that we can set the status bar to almost anything using only HTLM's a href (no CSS nor JavaScript needed). All we need is to trick the browser's parser into thinking that the href value is a valid url and it will display it.

Try running this snippet:

<a href="http://.# this is p͕͓͔͕͓͔͕͓͔͕͓͔͕͓͔͕͓͔͕͓͔͕͓͔͕͓͔͕͓͔͕͓͔̐̑̓̐̑̓̐̑̓̐̑̓̐̑̓̐̑̓̐̑̓̐̑̓̐̑̓̐̑̓̐̑̓̐͜͜͜͜͜͜͜͜͜͜͜͜‌​̴̵̶͕͓͔͕͓͔͕͓͔͕͓͔̖͕͓̖̱̲̳̖̖̖̖̖̖̖͕̑̓̐̑̓̐̑̓̐̑̓̑̒̓̔̐̒̓̔̒̓̔̒̓̔̒̓̔̒̓̔̒̓̔̒̓̔̒̓̔̒̓̔̐̕̚͜͜͜͜͜‌​͓͔̖͕͓͔̖͕͓͔̖͕͓͔̖͕͓͔̖͕͓͔̖̑̓̑̒̓̔̐̑̓̑̒̓̔̐̑̓̑̒̓̔̐̑̓̑̒̓̔̐̑̓̑̒̓̔̐̑̓̑̒̓̔̕̚̕̚̕̚̕̚̕̚̕̚͜͜͜͜͜‌​͕͓͔̖͕͓͔̖̐̑̓̑̒̓̔̐̑̓̓̓̓̓̓̓̑̒̓̔̕̚̕̚͜͜owerful because ━Σ(゚Д゚|||)━ symbols !@)(*#&$^%</even htlm> or lorem ipsum in all scripts Лорем ипсум Lorem存有 ငါ့ရဲ့ဇာတ်မြင့် घरՏուն Дома ലോറെൻ  ഇപ്സം درமுகப்புЛорем ипсумలోלורם איפסוםరెం ఇప్సమ్ მთავარი હોમ לורם איפסוםלורם איפסום Forsíða Loremのイプサム ಮುಖಪುಟ ទំព័រដើម 가 lorem ipsum의 ຫນ້າທໍາອິດ Տուն আর্কাইভ">Hover this link (do not click) and observe the browser's status bar.</a>

Chrome's output (click image to maximize): (v46.0.2490.80 m)

enter image description here

FireFox's output: (v42.0)

enter image description here

IE's output: (v11.0.9600.17905 Update Versions 11.0.21 (KB3065822))

enter image description here

Opera's output: (v33.0.1990.58 stable)

enter image description here

Seamonkey's output: (v2.38)

enter image description here

Avant's output: (v Ultimate 2015 build 28)

  • IE 11 engine:

    enter image description here

  • IE compatible engine:

    enter image description here

  • Chrome engine:

    enter image description here

  • FireFox engine:

    enter image description here

Torch's output: (v42.0.0.10546)

enter image description here

Baidu's output: (v43.19.1000.119)

enter image description here

Maxthon's output: (v4.4.8.1000)

enter image description here


Also, it's not necessary to use # (the fragment identifier). Browsers will consider a text like http://some.message.here./and_more_message_here as a valid url too. Weirder strings might be considered valid depending on the browser:

  1. <a href="http://a.b.c.d/test_symbols_!#$%^&*()[]{};:'".><,//=+``~">

    (Chrome, FireFox, IE, SM, Torch, Baidu, Maxthon, Avant IE11, Avant IE Compat, Avant Chrome, Avant Firefox.)

    (Names are listed for browsers with expected output, names are striked ("example") for browsers with no status bar output, and names are underlined ("e̲x̲a̲m̲p̲l̲e̲") for browsers with unexpected output/behavior. Tested with browser versions same as the ones listed above.)

  2. <a href="http://a.b.c.d/test some spaces">

    (Chrome, FireFox, I̲E̲, SM, Torch, B̲a̲i̲d̲u̲, M̲a̲x̲t̲h̲o̲n̲, A̲v̲a̲n̲t̲ I̲E̲ ̲1̲1̲, A̲v̲a̲n̲t̲ I̲E̲ ̲C̲o̲m̲p̲a̲t̲, Avant Chrome, Avant Firefox.)

  3. <a href="http://test some . spaces in domain part/a_b_c_d_e">

    (C̲h̲r̲o̲m̲e̲, FireFox, I̲E̲, SM, T̲o̲r̲c̲h̲, B̲a̲i̲d̲u̲, M̲a̲x̲t̲h̲o̲n̲, A̲v̲a̲n̲t̲ I̲E̲ ̲1̲1̲, A̲v̲a̲n̲t̲ I̲E̲ ̲C̲o̲m̲p̲a̲t̲, A̲v̲a̲n̲t̲ C̲h̲r̲o̲m̲e̲, Avant Firefox)

  4. <a href="http://test some . spaces in domain part without slash">

    (C̲h̲r̲o̲m̲e̲, FireFox, I̲E̲, SM, T̲o̲r̲c̲h̲, B̲a̲i̲d̲u̲, M̲a̲x̲t̲h̲o̲n̲, A̲v̲a̲n̲t̲ I̲E̲ ̲1̲1̲, A̲v̲a̲n̲t̲ I̲E̲ ̲C̲o̲m̲p̲a̲t̲, A̲v̲a̲n̲t̲ C̲h̲r̲o̲m̲e̲, Avant Firefox)

  5. <a href="http://test_without_slash_and_dots">

    (Chrome, FireFox, IE, SM, Torch, Baidu, Maxthon, Avant IE11, Avant IE Compat, Avant Chrome, Avant Firefox)

  6. <a href="http://a.b.c:port_with_letters_test">

    (Chrome, FireFox, IE, SM, Torch, Baidu, Maxthon, Avant IE11, A̲v̲a̲n̲t̲ I̲E̲ ̲C̲o̲m̲p̲a̲t̲, Avant Chrome, Avant Firefox)

  7. <a href="http://http://double.http.test">

    (Chrome, FireFox, IE, SM, Torch, Baidu, Maxthon, Avant IE11, Avant IE Compat, Avant Chrome, Avant Firefox)

  8. <a href="http://test @ with spaces">

    (C̲h̲r̲o̲m̲e̲, FireFox, IE, SM, T̲o̲r̲c̲h̲, B̲a̲i̲d̲u̲, M̲a̲x̲t̲h̲o̲n̲, A̲v̲a̲n̲t̲ I̲E̲ ̲1̲1̲, A̲v̲a̲n̲t̲ I̲E̲ ̲C̲o̲m̲p̲a̲t̲, A̲v̲a̲n̲t̲ C̲h̲r̲o̲m̲e̲, Avant Firefox)

  9. <a href="http://test:password@ with spaces/">

    (C̲h̲r̲o̲m̲e̲, FireFox, IE, SM, T̲o̲r̲c̲h̲, B̲a̲i̲d̲u̲, M̲a̲x̲t̲h̲o̲n̲, A̲v̲a̲n̲t̲ I̲E̲ ̲1̲1̲, A̲v̲a̲n̲t̲ I̲E̲ ̲C̲o̲m̲p̲a̲t̲, A̲v̲a̲n̲t̲ C̲h̲r̲o̲m̲e̲, Avant Firefox)

  10. <a href="http:// test : password @with.spaces/">

    (C̲h̲r̲o̲m̲e̲, FireFox, IE, SM, T̲o̲r̲c̲h̲, B̲a̲i̲d̲u̲, M̲a̲x̲t̲h̲o̲n̲, A̲v̲a̲n̲t̲ I̲E̲ ̲1̲1̲, A̲v̲a̲n̲t̲ I̲E̲ ̲C̲o̲m̲p̲a̲t̲, A̲v̲a̲n̲t̲ C̲h̲r̲o̲m̲e̲, Avant Firefox)

  11. <a href="http://test@[email protected]">

    (C̲h̲r̲o̲m̲e̲, FireFox, IE, SM, T̲o̲r̲c̲h̲, B̲a̲i̲d̲u̲, Maxthon, A̲v̲a̲n̲t̲ I̲E̲ ̲1̲1̲, A̲v̲a̲n̲t̲ I̲E̲ ̲C̲o̲m̲p̲a̲t̲, A̲v̲a̲n̲t̲ C̲h̲r̲o̲m̲e̲, Avant Firefox)

  12. Repeat all of the test strings above, with http:// replaced by https://, ftp://, about://, chrome://, file://, foobar://, and etc.

We can see that if the browser doesn't consider the string to be a valid url, it will fail gracefully by displaying no status bar, so no harm done. (Except that it looks like there's some bugs going on for Avant IE Compat with the test string "http://a.b.c:port_with_letters_test".)


Getting the browser status bar to display our desired string is only the first step. The second step is to stop the browser from loading the page when the user clicks the link.

This can easily be done using return false:

<a onclick="return false" href="http://some.message.here./and_more_message_here">this link will not load</a>

or:

<a onclick="return f()" href="http://some.message.here./and_more_message_here">this link will not load</a>
<script>
  function f() {
    return false;
  }
</script>

Above two snippets are tested to work on Chrome, FireFox, IE, SM, Torch, Baidu, Maxthon, Avant IE11, Avant IE Compat, Avant Chrome, Avant Firefox.


The last step is to use window.location or window.open to mimic the behavior of a href. It can be done inline: (online test)

<!doctype html>
<a onclick="location='http://example.org'; return false" href="https://some.message.here./and_more_message_here">same tab</a>
<br><a onclick="window.open('http://example.org'); return false" href="https://some.message.here./and_more_message_here">new tab</a>


Or using return func(): (online test)

<!doctype html>
<a onclick="return f1()" href="http://some.message.here./and_more_message_here">same tab 2</a>
<br><a onclick="return f2()" href="http://some.message.here./and_more_message_here">new tab 2</a>
<script>
  function f1() {
    location = 'http://example.org';
    return false;
  }

  function f2() {
    open('http://example.org');
    return false;
  }
</script>

Or inline with setTimeout: (online test)

<!doctype html>
<a onclick="setTimeout(function(){location='http://example.org';},1); return false" href="https://some.message.here./and_more_message_here">same tab 3</a>
<br><a onclick="setTimeout(function(){window.open('http://example.org');},1); return false" href="http://some.message.here./and_more_message_here">new tab 3 (doesn't work on Avant IE11 and Avant IE Compat if this link is HTTP; works if it is HTTPS or FTP)</a> 


Or using return func() with setTimeout: (online test)

<!doctype html>
<a onclick="return f1()" href="http://some.message.here./and_more_message_here">same tab 4</a>
<br><a onclick="return f2()" href="http://some.message.here./and_more_message_here">new tab 4 (doesn't work on Avant IE11 and Avant IE Compat if this link is HTTP; works if it is HTTPS or FTP)</a> <!-- hadn't tested this with sourcepage=HTTP. only tested with sourcepage=HTTPS and sourcepage=localwebpage -->
<script>
  function f1() {
    setTimeout(function() {
      location = 'http://example.org';
    }, 1);
    return false;
  }

  function f2() {
    setTimeout(function() {
      open('http://example.org');
    }, 1);
    return false;
  }
</script>

Above two snippets are also tested to work on Chrome, FireFox, IE, SM, Torch, Baidu, Maxthon, Avant IE11 (with caveat stated in the code), Avant IE Compat (with caveat stated in the code), Avant Chrome, Avant Firefox.

嘦怹 2024-08-12 01:57:00

jQuery 不是执行此操作所必需的:

<script>
function writetostatus(input){
    window.status=input
    return true
}
</script>

但是,大多数较新的浏览器会阻止您通过 JavaScript 设置状态栏中的文本。

jQuery is not necessary to do this:

<script>
function writetostatus(input){
    window.status=input
    return true
}
</script>

However, most newer browsers prevent you from setting the text in the status bar from JavaScript.

一城柳絮吹成雪 2024-08-12 01:57:00

对于可能感兴趣的人,请注意特定于 IE 的简单注释:

直到 IE6 并包含它,您可以这样做:

window.status = "Hello, I'm a custom status bar note.";

但在 IE6 之后(测试过 IE7/8) 您以相同的方式执行此操作,但是您还需要通过打开该功能来调整浏览器安全选项:工具 - Internet 选项 - 安全 - 自定义级别:

替代文字

To whom it may concern a simple note specific to IE:

Until IE6 and including it you could do:

window.status = "Hello, I'm a custom status bar note.";

But after IE6 (tested IE7/8) you do it in the same way, but you need also to adapt the browser security options by turning the feature on: Tools - Internet Options - Security - Custom Level:

alt text

风透绣罗衣 2024-08-12 01:57:00

首先,它的外观在各个浏览器中并不统一,其次,该功能 已被禁用很长一段时间

无论如何,执行此操作的 javascript 是一个简单的 window.status = "my text"

First of all, its appearence is not uniform throughout browsers, and secondly, that functionality has been disabled for a long time by default on most browsers for security reasons.

Anyway, the javascript for doing that is a simple window.status = "my text"

你穿错了嫁妆 2024-08-12 01:57:00

10 年老问题的答案。如果想法是隐藏链接指向的位置。
我用这个功能

<script>
    function go2(hell){ window.location=hell; }
</script>

and the links will be like this :
<a href="#" onclick="go2('www.somewhere.net/page.html')">my link</a>

An answer to 10 yrs old question.If the idea was to hide where links lead to.
I use this function

<script>
    function go2(hell){ window.location=hell; }
</script>

and the links will be like this :
<a href="#" onclick="go2('www.somewhere.net/page.html')">my link</a>
蓝梦月影 2024-08-12 01:57:00

使用

window.status =“无论你想要什么”

use

window.status = "whatever you want"

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