Skip to content Skip to sidebar Skip to footer

Javascript, Iframe, Security - Permission Denied When Tring To Access A Js Function From Parent Window

Good day to all. I have a page that includes an iframe. In that iframe I have a script with function called test(). I need to access the function from the parent window. After ask

Solution 1:

It's prohibited to access pages from other domains by default, because browsers use same origin policy. There are several workaround like using location.hash or window.name to communicate between frames. The most recent and standardized in HTML5 is postMessage-interface. There is library for cross-browser solution http://easyxdm.net/wp/.

Solution 2:

I am not sure if it is possible, cross window (frame) communication have to be at same domain, protocol and hostname. For more info see Same origin policy for JavaScript and Cross domain communication with iframes

Post a Comment for "Javascript, Iframe, Security - Permission Denied When Tring To Access A Js Function From Parent Window"