window.opener.document.getElementById("parentId1").value = myvalue not working
is there any issue in communicating with a secure child window and a parent page which is not secure?
Yes. HTTP and HTTPS make for separate script origins. (If they were not separate origins then an unprotected page could script into an HTTPS page and change all its content, defeating the purpose of HTTPS.)
If so how can I solve this issue?
Same origin. Serve the parent page through HTTPS, and either put them on the same hostname or set
document.domain
to a shared parent domain on both documents.Cross-origin messaging.
window.postMessage
; if you need to support older browsers (primarily IE<8) then there are horrible backwards compatibility hacks (like communicating throughdocument.cookie
or hash navigation).Server interaction. One document sends the information to the server and the server shares it back with the other document (eg using XMLHttpRequest).
Nidheesh
Updated on June 04, 2022Comments
-
Nidheesh almost 2 years
I was trying to get the value from my child.jsp to my parent.jsp using
window.opener.document.getElementById("parentId1").value = myvalue;
Even though there were no errors found in the console the value is not getting in the parent page.
The child popup window has the url starting like,
https://safe.cresecure.net/securepayments.....
and the parent pageurl
starts withhttp://....
is there any issue in communicating with a secure child window and a parent page which is not secure?If so how can I solve this issue?