简体   繁体   中英

Changing the title of the current tab or browser window

当您收到1条通知或消息时,如何将Facebook的标题更改为“(1)Facebook”的方式更改显示在浏览器选项卡上的网站的当前标题?

只是做这个...

document.title = 'my new title';
document.title = 'new title';

要么

document.getElementsByTagName('title')[0].innerHTML = 'new title';

JavaScript:

document.title = 'my title';
document.title = "your title";

Javascript:

document.getElementsByTagName("title")[0].innerHTML = "Your Desired Title"

OR

HTML:

<title id="page-title"></title>

Javascript:

document.getElementById("page-title").innerHTML = "Your Desired Title" 

jQuery的方式

$("title").html("your title");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM