javascript - window.opener.document.getElementById("parentId1").value = myvalue not working - Stack Overflow

I was trying to get the value from my child.jsp to my parent.jsp using window.opener.document.getEleme

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, ..... and the parent page url starts with http://.... is there any issue in municating with a secure child window and a parent page which is not secure?

If so how can I solve this issue?

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/securepayments..... and the parent page url starts with http://.... is there any issue in municating with a secure child window and a parent page which is not secure?

If so how can I solve this issue?

Share Improve this question asked Aug 21, 2013 at 7:35 NidheeshNidheesh 4,56230 gold badges93 silver badges156 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 3

is there any issue in municating 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?

  1. 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.

  2. Cross-origin messaging. window.postMessage; if you need to support older browsers (primarily IE<8) then there are horrible backwards patibility hacks (like municating through document.cookie or hash navigation).

  3. Server interaction. One document sends the information to the server and the server shares it back with the other document (eg using XMLHttpRequest).

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744348047a4569807.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信