README 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. -------------------------------------------------------------------------------
  2. Project Name
  3. -------------------------------------------------------------------------------
  4. Version 0.5
  5. Release date: MM/DD/YYYY (in progres, porting)
  6. -------------------------------------------------------------------------------
  7. Project state:
  8. experimental
  9. -------------------------------------------------------------------------------
  10. Credits
  11. James Burke (jburke@dojotoolkit.org)
  12. -------------------------------------------------------------------------------
  13. Project description
  14. The XHR IFrame Proxy (xip) allows you to do cross-domain XMLHttpRequests (XHRs).
  15. It works by using two iframes, one your domain (xip_client.html), one on the
  16. other domain (xip_server.html). They use fragment IDs in the iframe URLs to pass
  17. messages to each other. The xip.js file defines dojox.io.proxy.xip. This module
  18. intercepts XHR calls made by the Dojo XHR methods (dojo.xhr* methods). The module
  19. returns a facade object that acts like an XHR object. Once send is called on the
  20. facade, the facade's data is serialized, given to xip_client.html. xip_client.html
  21. then passes the serialized data to xip_server.html by changing xip_server.html's
  22. URL fragment ID (the #xxxx part of an URL). xip_server.html deserializes the
  23. message fragments, and does an XHR call, gets the response, and serializes the
  24. data. The serialized data is then passed back to xip_client.html by changing
  25. xip_client.html's fragment ID. Then the response is deserialized and used as
  26. the response inside the facade XHR object that was created by dojox.io.proxy.xip.
  27. -------------------------------------------------------------------------------
  28. Dependencies:
  29. xip.js: Dojo Core, dojox.data.dom
  30. xip_client.html: none
  31. xip_server.html: none (but see Additional Notes section)
  32. -------------------------------------------------------------------------------
  33. Documentation
  34. There is some documentation that applies to the Dojo 0.4.x version of these files:
  35. http://dojotoolkit.org/book/dojo-book-0-4/part-5-connecting-pieces/i-o/cross-domain-xmlhttprequest-using-iframe-proxy
  36. The general theory still applies to this code, but the specifics are different
  37. for the Dojo 0.9+ codebase. Doc updates hopefully after the basic code is ported.
  38. The current implementation destroys the iframes used for a request after the request
  39. completes. This seems to cause a memory leak, particularly in IE. So, it is not
  40. suited for doing polling cross-domain requests.
  41. -------------------------------------------------------------------------------
  42. Installation instructions
  43. Grab the following from the Dojox SVN Repository:
  44. http://svn.dojotoolkit.org/var/src/dojo/dojox/trunk/io/proxy/xip.js
  45. http://svn.dojotoolkit.org/var/src/dojo/dojox/trunk/io/proxy/xip_client.html
  46. Install into the following directory structure:
  47. /dojox/io/proxy/
  48. ...which should be at the same level as your Dojo checkout.
  49. Grab the following from the Dojox SVN Repository:
  50. http://svn.dojotoolkit.org/var/src/dojo/dojox/trunk/io/proxy/xip_server.html
  51. and install it on the domain that you want to allow receiving cross-domain
  52. requests. Be sure to read the documentation, the Additional Notes below, and
  53. the in-file comments.
  54. -------------------------------------------------------------------------------
  55. Additional Notes
  56. xip_client.html and xip_server.html do not work right away. You need to uncomment
  57. out the script tags in the files. Additionally, xip_server.html requires a JS file,
  58. isAllowed.js, to be defined. See the notes in xip_server.html for more informaiton.
  59. XDOMAIN BUILD INSTRUCTIONS:
  60. The dojox.io.proxy module requires some setup to use with an xdomain build.
  61. The xip_client.html file has to be served from the same domain as your web page.
  62. It cannot be served from the domain that has the xdomain build. Download xip_client.html
  63. and install it on your server. Then set djConfig.xipClientUrl to the local path
  64. of xip_client.html (just use a path, not a whole URL, since it will be on the same
  65. domain as the page). The path to the file should be the path relative to the web
  66. page that is using dojox.io.proxy.