[Dojo-interest] Cross-site XHR
Yuan Yudistira
sabukhitam at gmail.com
Sun Dec 30 01:06:53 UTC 2007
I have done this by using a proxy.
JS file in server A request a PHP proxy in server A which then route
the request to server B.
Thanks
YUAN
On Dec 30, 2007 12:14 AM, Dustin Machi <dmachi at dojotoolkit.org> wrote:
> You can't do cross-site XHR for security reasons. They typical
> workaround is to use something like dojo.io.script / JSONP. This is
> limited to GET style requests as it is implemented by dynamically
> inserting <script> tags into the document body.
>
> Dustin
>
>
> Daniel wrote:
> > Hello,
> >
> > If I have a JS file in server A, I can't make an XHR connection to
> > server B. I assume that this is a security feature, to prevent some
> > forms of phishing. Am I right so far?
> >
> > Is there a way to get around this on Firefox? This is only for my own
> > use, not for the public. Maybe Firefox has a list of pages that are
> > allowed to do cross-site XHR?
> >
> > I'm not 100% sure of what I'm looking for, because I don't really know
> > why it doesn't work. But here is a test example:
> >
> > <html>
> > <body>
> > <script type="text/javascript" src="lib/dojo/dojo.js"></script>
> > <script type="text/javascript">
> > dojo.addOnLoad(function() {
> > document.write("Before");
> > dojo.xhrGet( {
> > url: "http://google.ca",
> > handleAs: "text",
> > load: function(response) {
> > document.write("Test");
> > }
> > });
> > document.write("After");
> > });
> > </script>
> > </body>
> > </html>
> >
> >
> > Thanks for the help.
> >
> >
> > Cheers,
> > Daniel.
> > _______________________________________________
> > FAQ: http://dojotoolkit.org/support/faq
> > Book: http://dojotoolkit.org/docs/book
> > Forums: http://dojotoolkit.org/forum
> > Dojo-interest at dojotoolkit.org
> > http://dojotoolkit.org/mailman/listinfo/dojo-interest
> >
>
> _______________________________________________
> FAQ: http://dojotoolkit.org/support/faq
> Book: http://dojotoolkit.org/docs/book
> Forums: http://dojotoolkit.org/forum
> Dojo-interest at dojotoolkit.org
> http://dojotoolkit.org/mailman/listinfo/dojo-interest
>
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"Limitless undying love
which shines around me like a million suns
It calls me on and on across the universe...."
Accross The Universe - The Beatles -
--------------------------------------------
Visit :
http://www.sabukhitam.com/
======================
More information about the Dojo-interest
mailing list