Skip to content

Domain name – Ajax, Iframe and JSONP

December 11, 2009

“The same origin policy prevents a document or script loaded from one origin from getting or setting properties of a document from another origin. This policy dates all the way back to Netscape Navigator 2.0. Two pages to have the same origin if the protocol, port (if one is specified), and host are the same for both pages.”

More details on this here:

Thus setting document.domain property value allows iframe to communicate with javascript of parent window. However tried doing ajax calls between sub domains with that approach, and it does not work on FF , IE.  JSONP is another approach to execute js on any other site and insert the output  – which should be a function call wrapping JSON in the page itself.  For POST requests however, this approach is not feasible.  Details of this approach are described here:

doing a Cross domain call :

No comments yet

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: