Facebook 的 xd_receiver 文件的概念
我考虑过构建一个简单的 API 来让用户获取我们的一些数据。
如果您想提供 json 或 xml 数据,迟早会遇到跨域问题。我不希望我的用户在他们自己的机器上放置一些卷曲的 proxy.php 文件来解决这个问题 - 所以我想知道 - Facebook 是如何处理这个问题的?
xd_receiver.htm 文件背后的魔力是什么(请参阅下面的内容)?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<body>
<script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/XdCommReceiver.js" type="text/javascript"></script>
</body>
</html>
x域问题还有其他解决方案吗?不切换到 JSONP?
谢谢
I thought about building a simple API to let users grab some of our data.
Sooner or later you'll run into the cross-domain issue if you want to provide json or xml data. I don't want my users to put some curly proxy.php file on their own machines to solve that problem - so I was wondering - how is Facebook handling this issue?
What's the magic behind the xd_receiver.htm file (see content below)?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<body>
<script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/XdCommReceiver.js" type="text/javascript"></script>
</body>
</html>
Are there other solution to the x-domain problem? Without switching to JSONP?
thx
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当使用基于 FIM 的传输时,传输层仅使用此文件,但我认为他们不再依赖于此。
无论哪种方式,如果您想了解有关跨域消息传递的更多信息,请阅读这篇文章: ScriptJunkie,然后看看 easyXDM 库,它可以为您完成所有操作 - 它甚至提供 RPC。
This file is simply used by the transport layer when using FIM based transport, but I don't think they rely on this anymore.
Either way, if you want to learn more about Cross Domain Messaging, then read this article at ScriptJunkie, then take a look at the easyXDM library, which does everything for you - it even provides RPC.