Skip to content

Instantly share code, notes, and snippets.

@jdaigle
Created March 14, 2012 00:02
Show Gist options
  • Save jdaigle/2032837 to your computer and use it in GitHub Desktop.
Save jdaigle/2032837 to your computer and use it in GitHub Desktop.
Cross-domain requests
1. load document in domain.com which contains iframe that points to sub.domain.com
2. document loaded from sub.domain.com should automatically set document.domain=domain.com
- this is required so that the parent frame can access the child frame
3. from parent document: new frames[0].XMLHttpRequest()
- now you have an XHR document which can open and send to sub.domain.com
4. if uses jquery, pass this XHR into $.ajax() via options
This should work in every modern web browser, including IE7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment