使用 Facebook 打开图表和“赞”按钮时返回意外值
我的 HTML 头中有以下 HTML:
<meta content="***" property="fb:admins">
<meta content="***" property="fb:app_id">
<meta content="Site.com" property="og:site_name">
<meta content="http://site.com/thumbnail.png" property="og:image">
<meta content="activity" property="og:type">
<meta content="Test Title" property="og:title">
<meta content="http://site.com/page/?Id=56&Source=" property="og:url">
<meta content="Test Activity Description" property="og:description">
但我没有在 facebook feed 中显示指定的详细信息,而是获得了 site.com/page 的链接(后面没有 URL 变量),标题似乎是来自
知道我做错了什么吗?
编辑
通过 linter 运行页面引发了一些有趣的问题。
http://developers.facebook.com/tools/lint/?url=http%3A%2F%2Fwaggleb.com%2F12454874521145474-2%2F
问题似乎源于事实图像、URL、标题和描述是使用 javascript 生成的。当facebook回调时,是否不允许JS在获取结果之前运行?
我需要用 javascript 更改数据,除非有办法通过 PHP 传递整个页面,挑选出我需要的数据,然后将正确的 URL、标题、描述和图像放入元标记中。我无法直接访问数据库,因此我必须从 DOM
检索此数据
I have the following HTML in my HTML head:
<meta content="***" property="fb:admins">
<meta content="***" property="fb:app_id">
<meta content="Site.com" property="og:site_name">
<meta content="http://site.com/thumbnail.png" property="og:image">
<meta content="activity" property="og:type">
<meta content="Test Title" property="og:title">
<meta content="http://site.com/page/?Id=56&Source=" property="og:url">
<meta content="Test Activity Description" property="og:description">
But rather than the details I have specified showing up in my facebook feed, instead I get a link to site.com/page (without the URL variables after it), the title seems to be coming from the <title>
rather than the <meta content="Test Title" property="og:title">
and the description is coming from the first <p>
on site.com/page
(which isn't there when you include the URL variables)
any idea what I am doing wrong?
EDIT
Running the page through linter has thrown up some interesting issues.
http://developers.facebook.com/tools/lint/?url=http%3A%2F%2Fwaggleb.com%2F12454874521145474-2%2F
The problem seems to stem from the fact that the image, the URL, the title and description are generated using javascript. When facebook calls back does it not allow the JS to run before fetching the results?
I need to change the data with javascript unless there is a way to pass the whole page through PHP, pick out the data I need and then place the correct URL, title, description and image into the meta tags. I do not have direct access to the database, so I must retrieve this data from the DOM
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许在您放入这些标签之前它已被 Facebook 缓存。
尝试在 Linter 中清理它们:http://developers.facebook.com/tools/lint/
Maybe it was cached by facebook before you put in these tags.
Try to clean them in Linter: http://developers.facebook.com/tools/lint/