我搜索了StackOverflow,我发现的是这个例子:
$("Meta[property=og:title]").attr("content",title); $("Meta[property=og:url]").attr("content",url);
<Meta property="og:title" content="some content"/> <Meta property="og:url" content="some content"/> <Meta property="og:site_name" content="some content"/>
当我运行应该更改’title’和’url’变量的内容的函数时,不会发生更改. “内容”的相同值仍然保持不变.
我想知道如果可能的话,如何使用JQuery来改变Facebook元标记的价值.
解决方法
Editing Meta Tags
You can update the attributes of your page by updating your page’s
tags. Note that og:title and og:type are only editable
initially – after your page receives 50 likes the title becomes fixed,
and after your page receives 10,000 likes the type becomes fixed.
These properties are fixed to avoid surprising users who have liked
the page already. Changing the title or type tags after these limits
are reached does nothing,your page retains the original title and
type.For the changes to be reflected on Facebook,you must force your page
to be scraped. The page is scraped when an admin for the page clicks
the Like button or when the URL is entered into the Facebook URL
Linter. You can programmatically force your page to be scraped by
cURL’ing the linter. For example …