使用JQuery更改Facebook元标记内容属性

我想知道如何使用JQuery来替换我的Facebook元标记内容属性.

搜索了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元标记的价值.

解决方法

绝对可以使用jQuery更改元标记,但我认为这不会达到你想要的,因为元标记是由FB scraper提取的. FB刮刀熄灭并刮擦您的页面以读取元标记.

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 …

https://developers.facebook.com/docs/opengraph/

相关文章

页面搜索关键词突出 // 页面搜索关键词突出 $(function () {...
jQuery实时显示日期、时间 html: &lt;span id=&quot...
jQuery 添加水印 &lt;script src=&quot;../../../.....
中文:Sys.WebForms.PageRequestManagerParserErrorExceptio...
1. 用Response.Write方法 代码如下: Response.Write(&q...
Jquery实现按钮点击遮罩加载,处理完后恢复 思路: 1.点击按...