3 ms·
XDomain is not a CORS polyfill as incorrectly stated in the readme. If it actually supported CORS, you could configure it with Access-Control-* headers and it w
by Sephr 12y ago
XDomain is not a CORS polyfill as incorrectly stated in the readme. If it actually supported CORS, you could configure it with Access-Control-* headers and it would magically work. I wrote pmxdr[1] and libxdr[2] 5 years ago, which enable the same functionality while also actually supporting CORS headers, so it does magically work after dropping in.
[1]: https://github.com/eligrey/pmxdr https://github.com/eligrey/pmxdr
[2]: https://github.com/eligrey/libxdr https://github.com/eligrey/libxdr
- jpillora 12y agoAccepted your PR, this is indeed a CORS alternative, not a polyfil. I did think about utilizing CORS headers, however by placing a proxy.html file on your domain, you can be seen as implicitly allowing cross-domain requests. I've added a simple DSL to the script tag to futher restrict access. To only accept requests from 'foo.master-domain.com', just do: <script ... master="foo.master-domain.com"> Adding CORS to XDomain is an unnecessary complication, CORS requires modifying the server code, CORS can cause superfluous requests and CORS sucks. RE: pmxdr: since you don't replace XMLHttpRequest, it doesn't work after dropping it in. Does jQuery's $.ajax magically work? Angular's $http?