Forum Moderators: open

Message Too Old, No Replies

Cross Domain access

         

question

4:19 am on Dec 11, 2008 (gmt 0)

10+ Year Member



I am working on a page www.abc.com/index.jsp which has an iframe linked to www.xyz.com/index.jsp (both on different domains). My requirement is that on click of a button on the iframe, I need the focus to get back to a section of the page on www.abc.com/index.jsp.
I get a 'Access denied' error when i try the above.

I tried setting the domain of the page www.abc.com/index.jsp to 'xyz.com'. The domain of www.xyz.com/index.jsp is also set to 'xyz.com'. But I noticed that even though i explicitly try to set the domain on www.abc.com/index.jsp, it is not actually set and hence the 'Access denied' error.

Is there a workaround to get this work and remove the 'Access denied' error?

daveVk

5:20 am on Dec 11, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You are very restricted in what you can do, that said frame busters work cross domain by changing top.location.href

Try changing top.location.hash to required anchor in main page, this will upset your history ( back button ), also try top.location.replace() just changing hash part (avoids history problem).

Sephr

7:04 pm on Dec 24, 2008 (gmt 0)

10+ Year Member



Changing top.location.hash is normally not allowed cross-domain. I recommend using making using the Access-Control: header on both domains and use theOtherDomainIframe.contentWindow.postMessage('message contents', 'target domain') and set event listeners for 'message' if you must do cross-domain communication.

daveVk

7:25 am on Dec 27, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think postMessage may only be supported by mozzilla ?

Google for "cross domain ajax" for more ideas

Sephr

5:31 pm on Dec 28, 2008 (gmt 0)

10+ Year Member



postMessage is supported by Firefox 3+, Safari 3.1.2+, and IE8 beta 2