Search code examples
javascriptcross-domainframesame-origin-policyframeset

Cross Domain with frames


I have one html page with url :

http://server1/phone_app

which loads a frames from the url:

http://server2/directory_app

in the contained frame (directory_app), I need the displayed URL in the browser which is actually (http://server1/phone_app). Unfortunately, i have no access to the container page, and because of the "same origin policy", i can't access the window.top.location.href.

Is there any way to do this?

Browser : IE7


Solution

  • No. You cannot read data from other domains (except via things like JSON-P which are not applicable in this situation).

    You could pass in details into the frame via the query string:

    src="http://server2/directory_app?a=b;x=y"