js修改页面标题 title
如果对你有帮助的话麻烦点个【推荐】最好还可以follow一下我的GitHub感谢观看!
/* *
*添加首页description元数据meta标签
*创建一个meta元素,sName为该meta元素的name值, sDescription为该meta元素的description值。
*/
window.addEventListener('load', function () {
var docTitle = document.title;
document.title = docTitle.replace(" - 博客园","") + ' | Eric\'Blog'
var dMeta = document.createElement('meta');
var sName = 'keywords';
var sDescription = "梦逸灵箭";
dMeta.setAttribute('name', sName);
dMeta.setAttribute('content', sDescription);
document.head.appendChild(dMeta);
var dMeta1 = document.createElement('meta');
var sName1 = 'description';
var sDescription1 = "梦逸灵箭,博客,代码";
dMeta1.setAttribute('name', sName1);
dMeta1.setAttribute('content', sDescription1);
document.head.appendChild(dMeta1);
},false);
如果本文对你有帮助,请【关注】 【打赏】 或【分享】
有问题请添加个人微信:【mengyilingjian】 ,添加时请备注来意,谢谢!
![添加好友 添加好友](https://images.cnblogs.com/cnblogs_com/mengyilingjian/1570270/o_alipay.bmp)
本文欢迎各位转载,但是转载文章之后必须在文章页面中给出作者和原文出处链接。
★★★★★★★★★★ 来都来了,点个赞再走呗★★★★★★★★★★
![添加好友 添加好友](https://images.cnblogs.com/cnblogs_com/mengyilingjian/1570270/o_alipay.bmp)
![谢谢支持 打赏码](https://images.cnblogs.com/cnblogs_com/mengyilingjian/1570270/o_200623060543weixinshang.bmp)