开发者

Prepend to the title tag using jQuery?

开发者 https://www.devze.com 2022-12-26 17:41 出处:网络
I want to have my title tag look like this: My Website - Name of Page开发者_StackOverflow社区 I want to prepend the My Website - part so that I don\'t have to type it on every new page I make. So th

I want to have my title tag look like this:

My Website - Name of Page开发者_StackOverflow社区

I want to prepend the My Website - part so that I don't have to type it on every new page I make. So the title tag that I actually have on the page would be:

<title>Name of Page</title>

Is this possible?


I think a jquery script to do it would be:

$(document).ready(function() { 
    document.title = "Your WebSite Name - " + document.title; 
}); 

I would recommend doing this at the page level instead of client side though...


Seems others have tried and not been able to do is using jQuery but you can use document.title, http://hancic.info/change-page-title-with-jquery

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号