【发布时间】:2014-01-16 05:18:28
【问题描述】:
我想知道 facebook 如何从链接中提取打开的图形值。
<meta property="og:type" content="website">
<meta property="og:url" content="http://sample.com">
<meta property="og:title" content="sample title">
<meta property="og:description" content="sample description">
跨域是一个大问题,我认为如果链接只是在我的域上,我可以使用 AJAX 来实现。我也有这个想法通过<iframe> 像这样:
$('iframe').contents().find('meta[property=og:title]').attr("content");
//will output me: 'sample title'
但我还需要考虑 iframe 的加载/渲染时间,因此它不是最佳选择。任何帮助将不胜感激,谢谢。
PS。也有人可以告诉我 facebook 上支持的 og:type,这个链接好像坏了:https://developers.facebook.com/docs/reference/opengraph/object-type ;网站、博客、文章...?
【问题讨论】:
-
我找到了这个插件:jQuery URLive。它使用 yql 和 ajax 来获取跨域的数据,因此不需要后端/代理页面,这很棒。
标签: javascript jquery facebook iframe meta-tags