admin管理员组文章数量:1327261
I'm trying to add the notification number to the title in a function, but it won't work. This is my code:
var docTitle = document.title;
document.title = "".docTitle." (".$(".loadnot").html().")";
I'm trying to add the notification number to the title in a function, but it won't work. This is my code:
var docTitle = document.title;
document.title = "".docTitle." (".$(".loadnot").html().")";
Share
Improve this question
asked Oct 13, 2012 at 14:50
impimp
4702 gold badges7 silver badges23 bronze badges
4 Answers
Reset to default 9In JavaScript you should use +
for concatenating not .
.
document.title = docTitle + "(" + $(".loadnot").html() + ")";
Or even better:
document.title += " ("+$(".loadnot").html()+")";
If none of the answers above fit then is simply:
Some Javascript server side is blocking the changing of the document title.
Check how -> https://stackoverflow./a/27847787/16759195
All you have to do is to add to your code the following lines:
Object.defineProperty(document, 'title', {
enumerable: true,
configurable: true,
writable: true,
value: document.title
});
check this:
window.top.document.title = "Your Title";
本文标签: javascriptChanging document title is not workingStack Overflow
版权声明:本文标题:javascript - Changing document title is not working - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742209708a2433481.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论