-1

I have empty og tag at first

<meta property="og:title" />

and after some function , I fill that og tag with specific text.

($("#popup_result").append(mode(answers_result)), $("meta[property='og\\:title']").attr("content", "I have: " + $(".trivia_final_result").text()))
}

Problem is that , after sharing it on facebook, new og tag content does not appear, but when I open inspect element it shows changed tag, in source code it is still empty.

1 Answers1

1

As already said, Facebook will not read a tag populated by javascript as it does it's own scrape of the page when shared.

To do what you want to do, you need to share a link to the page where the og:meta is populated on the server. This can still be dynamic, maybe populated using a variable in the url, but it will have to be populated before the page is loaded.

You can see the meta Facebook sees by visiting the URL in the Facebook linter

EDIT:

It may also be possible to achive what you want to achieve with the feed dialog