Home  >  Article  >  Web Front-end  >  JavaScript tips for modifying browser tab titles_javascript tips

JavaScript tips for modifying browser tab titles_javascript tips

WBOY
WBOYOriginal
2016-05-16 16:22:051363browse

Modifying the title of tab or window is an older practice. Gmail uses it to prompt users for new chat messages. When a new page is loaded through AJAX, this site also uses it to update the tab title. How is this done? At that time, it was by setting the document object.

Copy code The code is as follows:

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

A common mistake is: you will think that you should modify window.title. But in fact, you should use the document object, otherwise what you do will definitely be useless. Pay attention, you will see: many times setInterval is used to actually update document.title to attract the user's attention!

Statement:
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