Update Facebook Open Graph meta tag through JavaScript

后端 未结 3 1007
一生所求
一生所求 2020-12-09 16:37

I\'m trying to update the meta content of the Facebook\'s Open Graph title. I updated the content, but when it published the feed, it\'s still pulling the old information. <

3条回答
  •  臣服心动
    2020-12-09 17:07

    I'm guessing you figured this out already, but others may have the same problem.

    You can't change the Open Graph meta tags with JavaScript after the pageload, as Facebook requests the page from the server again when looking for the meta tags, and so it will not find the updated tags.

    Furthermore, I found that Facebook only searches the header for the Open Graph meta tags, so adding them in the body will not work either.

提交回复
热议问题