views:

160

answers:

3

mysite.com has an iframe which loads some differentsite.com.

need to run javascript on this loaded iframe document.

Single Origin Policy kicks in.

i resort to using proxy. its slow, creates bottleneck, unable to fully render the site (JS is not rendered).

Alternatives ?

+1  A: 

Check this blog post of .Net Slave, I think it might solve your issue Iframe cross domain JavaScript calls

bashmohandes
only problem is when you are dealing with lot of different domains. how will you add them all to your subdomain DNS ?
likeafly39
+1  A: 

You could try window.postMessage(message, origin) (it would be parent.postMessage from the iframe and iframeElement.contentWindow.postMessage from the top page) for all of the latest major browsers (Firefox, IE, Safari, Chrome, etc.) and changing/polling window.name for old browsers.

Eli Grey
A: 

The first question would be, do you have control over the secondary domains, or are you able to persuade the webmasters of these to add additional components?

If so you could easily use easyXDM to call methods across the domain boundry. Demos of this can be viewed here

Sean Kinsey