JangoSteve/remotipart — pull request #114 by esbanarango (2014-08-06 22:11:06+00:00)
Title: Fix issue #61.

This PR fixes the issue when submitting via `remotipart` doesn't work with subdomains. The exact problem was:

````
Uncaught SecurityError: Blocked a frame with origin "http://subdomain.lvh.me:3000" from accessing a frame with origin "http://subdomain.lvh.me:3000".
The frame requesting access set "document.domain" to "newinbox.lvh.me", but the frame being accessed did not. Both must set "document.domain" to the same value to allow access.
````
The solution is mentioned on [MDN (Mozilla Developer Network)](https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy).

![solution](https://cloud.githubusercontent.com/assets/1156865/3834694/3aa654fe-1db4-11e4-88cc-3ae38cdb3f7e.png)

##### Why a "Try/Catch"?
That solution actually solves the subdomain issue, but it breaks when there is no subdomain, so we need to set `document.domain=document.domain` only when the iframe doesn't have access to the parent and vice versa, equals to having a subdomain.