I know this is an issue of cross-browser communication or same origin policy and browser will not allow such communication.
I need a work around this use-case.I have a parent page in HTTP and from there i am submitting the form to HTTPS, my requirement is not to move away from the page and the form is opening up in an overlay.
This is my current JSP settings
<form:form action="https://localhost:9002/myApp/springSecurity/login" class="login-form error-info" id="loginForm" method="post" commandName="loginForm" target="guestFrame">
<iframe width="0" frameborder="0" scrolling="no" name="guestFrame" >
from the server i am sending java-script in the response to be append on the Iframe, this is the java-script being sent from the server
<html><body>"+ "<script type=\"text/javascript\">parent.handleResponse('error',securityLoginStatus.getLoginFailedException());</script>"+ "</body></html>")
i have already defined a method in the parent window namely handle-response but i am getting following error in browser
Permission denied to access property 'handleResponse'
i even tried with parent.wwindow.handleResponse but getting same error.
is there any way i can communicate with the parent window from the Iframe ?
As you said before there is no way around to avoid cross origin permission denied unless both html origin and destiny be under
http://localhost:9002domain.For ease, I recommend using the http communication with javascript/json/jsonp docs.
You could try jQuery with something like that:
And in order to avoid the CORS restriction,
https://localhost:9002/myApp/springSecurity/loginhtml response must be a javascript code and includethe following headers:
Javascript example response which will be able to call “handleResponse” of its parent caller: