Skip to content Skip to sidebar Skip to footer

Javascript Cross Domain - "allow" Other Domains?

Description of steps Write 'callback' function on my custom page in my domain (called 'MyCallbackCallback', for the sake of argument) Open new window (from different domain) and p

Solution 1:

It’s not exactly clear from your question, but if you’re trying to use CORS, the server you’re requesting data from should add an Access-Control-Allow-Origin HTTP header, like so:

Access-Control-Allow-Origin: http://example.org/

Or, if it’s a public resource:

Access-Control-Allow-Origin: *

Older browsers don’t support CORS. If you need a fully cross-browser-compatible solution, use JSONP.


Solution 2:

Have a look at Cross-Domain AJAX requests:

JSONP is the only method compatible with older browsers though.


Solution 3:

If you want cross-domain communication without serverside proxies (perfect for the kind of RPC that you are describing) then take a look at easyXDM.

You can find multiple demos here.


Post a Comment for "Javascript Cross Domain - "allow" Other Domains?"