ak85
ak85

Reputation: 4264

Update html title and meta og:title with jquery

I can update my title tag with jquery which is not ideal but is required for a problem I am trying to solve.

jQuery(document).ready(
 function(){
var docTitle = document.title;
var newTitle = 'test';
document.title = newTitle + ' - ' + docTitle;
});

If I put the link through Facebook Lint I get the original title. Is there a way that this can be updated through jQuery so that in users timelines they will see the updated title?

Upvotes: 2

Views: 1124

Answers (1)

Simon Cross
Simon Cross

Reputation: 13345

Its pointless to update og:title via javascript.

Facebook reads those tags by performing an HTTP GET on your URL. THe Facebook scraper doesn't run javascript.

If you want a different object, you need a different URL. If you want to change the title of an existing object, you need to serve the new title when it is served over HTTP and parsed with no JS.

Upvotes: 2

Related Questions