简体   繁体   中英

How to set tab title when opening a new tab?

I am opening a new tab like this

$('#HelpMenu li a').on('click', function (e) {
    let linkToAppendTo = "http://help.mysite.com/" + e.target.innerText;
    let openTab = window.open(linkToAppendTo, "_blank");
    openTab.focus();
});

and don't know how to change the opening tabs title.

As for the provided link that is only changing a current tab title, not a new one that has been opened as I am showing

尝试在新标签的onload事件上设置标题。

openTab.onload = function() { this.document.title = "Title"; }

Try this

let openTab = window.open(linkToAppendTo, "_blank");
openTab.document.title = "Some 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