尝试使用客户端 jquery 和 ajax 更新 Facebook Open Graph 元标记 [英] Trying to update Facebook Open Graph meta tags using client side jquery and ajax

查看:30
本文介绍了尝试使用客户端 jquery 和 ajax 更新 Facebook Open Graph 元标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 ajax 来呈现一个内容页面,其中包含一个 Facebook Like Button 插件.

I use ajax to render a content page with a Facebook Like Button plugin in it.

问题是当用户点击 Like 时,Facebook 会提取元信息,但我不知道如何使用 ajax 分配元信息.

The problem is that when the user clics Like, Facebook will extract meta info but I don't know how to assign the meta with ajax.

我尝试使用 append to head int FB.init 但它似乎不起作用并且当用户喜欢 Facebook 上的页面时更新没有反映

I tried using append to head int FB.init but it seems to not work and the update isn't reflected when users like the page on Facebook

$('head').append("<meta property="og:title" content="The Rock"/>');

推荐答案

问题是 facebook like 会提取元信息,但我不知道如何使用 ajax 分配元信息.

The problem is that facebook like will extract meta info but I don't know how to assign the meta with ajax.

我尝试使用 append to head int FB.init 但它似乎不起作用.

I tried use append to head int FB.init but it seems not work.

当然这行不通,因为 Facebook 的抓取工具从您的服务器请求您的 URL – 并且不关心 DOM 当前在任何用户的浏览器.

Of course this does not work, because Facebook’s scraper requests your URLs from your server – and does not care about what the DOM might currently look like in any user’s browser.

不能在客户端添加开放图谱元数据.

You can not add Open Graph meta data client-side.

这篇关于尝试使用客户端 jquery 和 ajax 更新 Facebook Open Graph 元标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆