javascript Facebook Like 按钮如何工作?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8256083/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How does the Facebook Like button work?
提问by Brad Wright
I want to provide a simple piece of Javascript (or an iframe, I guess) that allows 3rd parties to embed functionality from my site in theirs. The user of said widget will be authenticated on our site already - so basically the Facebook Like button, or Facebook Connect, are the closest examples I could find.
我想提供一段简单的 Javascript(或 iframe,我猜),允许 3rd 方将我网站的功能嵌入到他们的网站中。所述小部件的用户已经在我们的网站上进行了身份验证 - 所以基本上 Facebook Like 按钮或 Facebook Connect 是我能找到的最接近的示例。
Since Facebook has a few different buttons I'm struggling to understand exactly what they're doing though. Is there a succinct (and technical - I'm a developer and want to build my own widget) explanation somewhere? I'm particularly focused on the security issues involved.
由于 Facebook 有几个不同的按钮,我很难确切地了解它们在做什么。某处是否有简洁的(和技术性的 - 我是一名开发人员,想构建自己的小部件)解释?我特别关注所涉及的安全问题。
回答by Nathan
回答by spedy
I believe the Like button is using cookies to obtain your FB user information, that with additional attributes are then sent to a service endpoint.
我相信 Like 按钮正在使用 cookie 来获取您的 FB 用户信息,然后将附加属性发送到服务端点。
As for security measures, an obvious would be to allow requests only from websites with given access keys.
至于安全措施,显而易见的是只允许来自具有给定访问密钥的网站的请求。