views:

406

answers:

1

Hi,

using Dojo, is it possible to make an Ajax call using xhrPost from an HTTP view to a HTTPS url ? The url must be HTTPS (as defined in Struts).

If I simply set "MyCommand" as the 'url' parameter of the xhrGet, I get a 302 error code.

If I transform "MyCommand" using javascript to something like "https://......./servlet/MyCommand" I see the following error in Firebug : "uncaught exception: Permission denied to call method XMLHttpRequest.open".

I'm stuck using both approaches, the only solution I found is to remove the "https" clause in the struts configuration file, and of course this is not a correct solution :)

Thanks for any help.

Best regards,

Nils

+1  A: 

connection to https from http involves a different port of the target. This violates the same-origin policy which should be enforced by the browser to the running javascript code.

It should work with an iframe..

dojo.io.iframe encapsulates this behaviour for you http://docs.dojocampus.org/dojo/io/iframe

If your server responds with a redirect to a non-ssl (correctly to same-origin) page you should be able to read the response (because the iframe is now in the same-origin).

squiddle