Why is my iframe blocked by cross origin even it is not
Why is my iframe blocked by cross origin even it is not I have a <iframe> inside a <div> . My outer url is http://localhost:9090 and the src in iframe is http://localhost:9090/Server/v1 . In my outer context I have below code to access iframe dom: <iframe> <div> http://localhost:9090 http://localhost:9090/Server/v1 const f1 = window.frames[iframeName]; const iFrameHead = f1.document.getElementsByTagName("head")[0]; and I get an exception on the second line: Uncaught DOMException: Blocked a frame with origin "http://localhost:9090" from accessing a cross-origin frame. The reason I want to access ifame dom is that I need to insert a script into that iframe. The src in iframe has the same protocol, hostname and port number. What I don't understand is the iframe is on the same origin as the parent context. Why does it complain about the cross origin? After some debugging, I found there is because the iframe was redirected to a different ...
