简体   繁体   English

为什么“ Facebook分享”示例不起作用?

[英]Why doesn't the Facebook Share example work?

Trying to implement the example from here. 尝试从此处实施示例。

Facebook Share passes along the URL of your page to our servers, which in turn looks up certain HTML tags within it. Facebook Share沿页面的URL传递到我们的服务器,服务器依次在其中查找某些HTML标签。 Those tags are used to display a preview of the page. 这些标签用于显示页面的预览。 In order to provide this preview, we always look for the title of the page, a summary of the main content and an image. 为了提供此预览,我们总是寻找页面标题,主要内容摘要和图像。

http://developers.facebook.com/docs/share http://developers.facebook.com/docs/share

I added the share button to my site as described on the share page linked above. 如上面链接的共享页面所述,我将共享按钮添加到了我的网站。

<a name="fb_share"></a> 
<script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" 
        type="text/javascript">

In the header I added the tags it requires to create the preview in the news feed. 在标题中,我添加了在新闻提要中创建预览所需的标签。 (I used the example tags, just to see if it would work.) (我使用了示例标签,只是看它是否可以工作。)

<meta property="og:title" content="Smith hails 'unique' Wable legacy" /> 
<meta property="og:description" content="John Smith claims beautiful football 
            is the main legacy of Akhil Wable's decade at the club. " /> 
<meta property="og:image" content="http://www.onjd.com/design05/images/PH2/WableAFC205.jpg" />


</script>   

When the shared button is clicked it takes me to small shared window and I hit share. 单击共享按钮后,将我带到一个小的共享窗口,然后单击共享。

However, when I navigate to my news feed, no preview of the page shows and none of the header tag information. 但是,当我导航到新闻源时,该页面没有预览,也没有标题标签信息。 It just shows: 它只是显示:

Greg McNulty http://localhost:2259/iState/Shared.aspx?id=a051fc1b-4f51-485b-a07d-0f378528974e localhost 7 minutes ago · LikeUnlike · Comment · Share Greg McNulty http:// localhost:2259 / iState / Shared.aspx?id = a051fc1b-4f51-485b-a07d-0f378528974e localhost 7分钟前·LikeUnlike·评论·分享

Why isn't the preview working? 为什么预览不起作用? (I get this same result without the header tags.) (我得到了没有标题标签的相同结果。)

Thank You. 谢谢。

(FYI - I am using the share because it allows for multiple shares of the same page whenever needed, compared to the like that allows it once and then the button physically changes saying the page is already liked.) (仅供参考-我正在使用共享,因为与允许一次共享的页面相比,该页面允许在需要时允许同一页面的多个共享,然后按钮实际发生变化,表明该页面已被点赞。)

You can test how Facebook servers see your webpage by feeding the URL to this service. 您可以通过将URL输入此服务来测试Facebook服务器如何查看您的网页。

http://developers.facebook.com/tools/lint/ http://developers.facebook.com/tools/lint/

In order for OpenGraph to work a facebook server must be able to visit the URL without a session or cookie. 为了使OpenGraph工作,facebook服务器必须能够在没有会话或cookie的情况下访问URL。 This means "localhost" web pages cannot pass open graph data. 这意味着“本地主机”网页无法传递打开的图形数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM