changing facebook Open Graph protocol value when button click
Below are codes that I want to change when I click jquery button?
<head>
<title>The Rock (1996)</title>
<meta property="og:title" content="Th开发者_开发知识库e Rock"/>
<meta property="og:type" content="movie"/>
<meta property="og:url" content="http://www.imdb.com/title/tt0117500/"/>
<meta property="og:image" content="http://ia.media-imdb.com/rock.jpg"/>
<meta property="og:site_name" content="IMDb"/>
<meta property="fb:admins" content="USER_ID"/>
<meta property="og:description"
content="A group of U.S. Marines, under command of
a renegade general, take over Alcatraz and
threaten San Francisco Bay with biological
weapons."/>
...
</head>
I have a question if is possible to make this when share button click and the change value on Open Graph protocol will get in share link?
Changing these with JavaScript will not change what shows on Facebook. Facebook's method of retrieving these values will ignore any JavaScript on the page and parse whatever is in the source.
Have you tried accessing the mata tags this way:
$('meta[property=og:title]').attr("content", "new content");
$('meta[property=og:type]').attr("content", "new content");
and so on..?
$(element).bind("click", function(){
$('meta[property=og:title]').attr("content", "new content");
$('meta[property=og:type]').attr("content", "new content");
// ....
// Do share action
});
精彩评论