| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 | -------------------------------------------------------------------------------Project Name-------------------------------------------------------------------------------Version 0.6Release date: 01/31/2008-------------------------------------------------------------------------------Project state:experimental-------------------------------------------------------------------------------Credits	James Burke (jburke@dojotoolkit.org)-------------------------------------------------------------------------------Project descriptionThe XHR IFrame Proxy (xip) allows you to do cross-domain XMLHttpRequests (XHRs).It works by using two iframes, one your domain (xip_client.html), one on the other domain (xip_server.html). They use fragment IDs in the iframe URLs to passmessages to each other. The xip.js file defines dojox.io.proxy.xip. This moduleintercepts XHR calls made by the Dojo XHR methods (dojo.xhr* methods). The modulereturns a facade object that acts like an XHR object. Once send is called on thefacade, the facade's data is serialized, given to xip_client.html. xip_client.htmlthen passes the serialized data to xip_server.html by changing xip_server.html'sURL fragment ID (the #xxxx part of an URL). xip_server.html deserializes themessage fragments, and does an XHR call, gets the response, and serializes thedata. The serialized data is then passed back to xip_client.html by changingxip_client.html's fragment ID. Then the response is deserialized and used asthe response inside the facade XHR object that was created by dojox.io.proxy.xip.-------------------------------------------------------------------------------Dependencies:xip.js: Dojo Core, dojox.data.domxip_client.html: nonexip_server.html: none (but see Additional Notes section)-------------------------------------------------------------------------------DocumentationThere is some documentation that applies to the Dojo 0.4.x version of these files:http://dojotoolkit.org/book/dojo-book-0-4/part-5-connecting-pieces/i-o/cross-domain-xmlhttprequest-using-iframe-proxyThe general theory still applies to this code, but the specifics are differentfor the Dojo 0.9+ codebase. Doc updates hopefully after the basic code is ported.The current implementation destroys the iframes used for a request after the requestcompletes. This seems to cause a memory leak, particularly in IE. So, it is notsuited for doing polling cross-domain requests.-------------------------------------------------------------------------------Installation instructionsGrab the following from the Dojox SVN Repository:http://svn.dojotoolkit.org/var/src/dojo/dojox/trunk/io/proxy/xip.jshttp://svn.dojotoolkit.org/var/src/dojo/dojox/trunk/io/proxy/xip_client.htmlInstall into the following directory structure:/dojox/io/proxy/...which should be at the same level as your Dojo checkout.Grab the following from the Dojox SVN Repository:http://svn.dojotoolkit.org/var/src/dojo/dojox/trunk/io/proxy/xip_server.htmland install it on the domain that you want to allow receiving cross-domainrequests. Be sure to read the documentation, the Additional Notes below, andthe in-file comments.-------------------------------------------------------------------------------Additional Notesxip_client.html and xip_server.html do not work right away. You need to uncommentout the script tags in the files. Additionally, xip_server.html requires a JS file,isAllowed.js, to be defined. See the notes in xip_server.html for more informaiton.XDOMAIN BUILD INSTRUCTIONS:The dojox.io.proxy module requires some setup to use with an xdomain build.The xip_client.html file has to be served from the same domain as your web page.It cannot be served from the domain that has the xdomain build. Download xip_client.htmland install it on your server. Then set djConfig.xipClientUrl to the local pathof xip_client.html (just use a path, not a whole URL, since it will be on the samedomain as the page). The path to the file should be the path relative to the webpage that is using dojox.io.proxy.
 |