JavaScript: Change browser window status message

天涯浪子 提交于 2019-12-29 07:56:13

问题


It was once possible to change the message a browser shows in the status bar at the bottom of the window. This functionality has been disabled in newer browser versions due to abuse.

<script type="text/javascript">
window.status = 'hello world';
</script>

Is there still any way to achieve this (consider jQuery available)? I think I still see pages around that change the status message, but they might use Flash or Java to change the window status.


回答1:


There are two things you can do without Flash or Java:

  1. Fake it: display a div that looks like a status bar.

    position: fixed;
    bottom: 0;
    left: 0;
    border: 1px solid silver;
    background: #aaaaaa;
    
  2. Choose URLs so that you show desired information to the user when they hover over links.

But please don't.




回答2:


Using the browsers statusbar to display page info is in most cases a very bad idea, the browsers has not disabled it without reason.

  1. Nobody looks down there to find such info.
  2. People expect it to show browser information. When hovering links for example i want to know if i leave the site, if it's a mailto:-link, if it's a pdf etc.

Instead use somthing like the orange(yellow?) thing stackoverflow have at the top of the page. "Are you new to stackoverflow...", "New posts has been added..." etc etc.




回答3:


Have a look at the pages still changing this info. If it is being done by javascript you should be able to see the source.



来源:https://stackoverflow.com/questions/536691/javascript-change-browser-window-status-message

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!