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
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.
精彩评论