JavaScript修改浏览器tab标题小技巧_javascript技巧

WBOY
Release: 2016-05-16 16:22:05
Original
1323 people have browsed it

修改tab或者window的标题,是一项较老的实践。Gmail 用它来提示用户新的聊天消息,当有新的page通过AJAX加载的时候,本站同样用它更新tab title。这是怎样做到的呢?当时是通过设置document对象。

复制代码代码如下:

document.title = 'Hello!'; // New title :)

有一个常识性的错误是:你会以为应该去修改 window.title。但实际上,你应该使用document对象,否则你做的肯定是无用的。注意一下,你将会看到:很多时候会用 setInterval来实际更新 document.title,用以引起用户的注意!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!