Allowing a child Iframe to call a function on its parent window from a different domain

You can communicate between frames via the message posting API. For example, in your child frame you might call: parent.postMessage(“child frame”, “*”); And in the parent frame, register a message handler: window.addEventListener(“message”, function(event) { console.log(“Hello from ” + event.data); });

Why is the HTML SCRIPT tag not subject to the same origin policy

I suppose this draft titled “Principles of the Same-Origin Policy” explains (albeit briefly) what’s pretty much in everyone’s head: In principle, user agents could treat every URL as a separate principal and isolate each document from every other URL unless the document explicitly indicated that it trusted that URL. Unfortunately, this design is cumbersome for … Read more

Internet Explorer 11 does not add the Origin header on a CORS request?

Internet Explorer’s definition of the “same origin” differs to the other browsers. See the IE Exceptions section of the MDN documentation on the same-origin policy: Internet Explorer has two major exceptions when it comes to same origin policy: Trust Zones: if both domains are in highly trusted zone e.g, corporate domains, then the same origin … Read more

Best method: Access-Control-Allow-Origin Multiple Origin Domains

The documentation on this seems to imply that it allows multiple origins with a space separated list, but that’s not what it actually means. Here’s what I could gather as the most definitive answer to your question: the Access-Control-Allow-Origin header should be the same value as the Origin header as long as you want to … Read more

Detect if the iframe content has loaded successfully

I found the following link via Google: http://wordpressapi.com/2010/01/28/check-iframes-loaded-completely-browser/ Don’t know if it solves the ‘Page Not Found’ issue. <script type=”javascript”> var iframe = document.createElement(“iframe”); iframe.src = “http://www.your_iframe.com/”; if (navigator.userAgent.indexOf(“MSIE”) > -1 && !window.opera) { iframe.onreadystatechange = function(){ if (iframe.readyState == “complete”){ alert(“Iframe is now loaded.”); } }; } else { iframe.onload = function(){ alert(“Iframe is … Read more

Cross-origin data in HTML5 canvas

To enable CORS (Cross-Origin Resource Sharing) for your images pass the HTTP header with the image response: Access-Control-Allow-Origin: * The origin is determined by domain and protocol (e.g. http and https are not the same) of the webpage and not the location of the script. If you are running locally using file:// this is generally … Read more

tech