1

I am trying to load a asp.net application inside php iframe. But When I am trying to view the iframe I am getting the error in asp.net not in php.

WebPage.aspx:500 Uncaught DOMException: Blocked a frame with origin "http://l503021" from accessing a cross-origin frame.

Php Code

<script>

function OpenForm()
{
    document.getElementById("ccFrame").src="http://l503021/valueonpage/WebPage.aspx";
    document.getElementById("popupDiv").style.display="block";
    document.getElementById("workingDiv").disabled=true;
}
</script>
janfitz
  • 694
  • 10
  • 20
  • 2
    The problem you are facing has nothing to do with PHP or ASP.Net. As the error message states it is being blocked due to cross-origin issues. Read more about that here... https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS – Reinstate Monica Cellio Jun 12 '17 at 07:28
  • How I can fix this issue. Could you please helpo me in this – Arjun Manoharan Jun 12 '17 at 07:32
  • Do you have access to the server that hosts the page you want to open inside the iframe? – Reinstate Monica Cellio Jun 12 '17 at 07:37
  • Yes I have the access to the server. The asp.net application is running in IIS and php application is running in Ubuntu(nginx) – Arjun Manoharan Jun 12 '17 at 07:41
  • See this question for your answer... https://stackoverflow.com/questions/40564439/enabling-cross-origin-request-in-asp-net-webforms – Reinstate Monica Cellio Jun 12 '17 at 07:49
  • @Archer Still I am getting the same error. – Arjun Manoharan Jun 12 '17 at 07:53
  • @Archer I think that's related to making ajax requests cross-domain, not using iframes. This may be more relevant: https://stackoverflow.com/questions/25098021/securityerror-blocked-a-frame-with-origin-from-accessing-a-cross-origin-frame , and this: https://github.com/ternarylabs/porthole which is mentioned in the first link . OP: you would need to re-think the code a little bit, by the looks of it. You can't make a simple JS command to directly manipulate elements within the cross-domain iframe in the way you are doing now. This is a security feature. – ADyson Jun 12 '17 at 08:53

0 Answers0