IFrame and Parent window
Can an iframe install a cookie or session on the parent page? How do i get value in an iframe to the parent page without using Ajax? I am trying to pass an Id value from th开发者_C百科e iframe to the parent page and then submit it.
From within your iframe, you can reference the parent document using parent.document
. If you had an input field in your parent window and wanted to set a value on it without using AJAX, you should simply be able to do the following using JavaScript:
parent.document.getElementById('myInputId').value = 'some value';
parent.document.getElementById('yourFormId').submit();
You can call functions in your parent page as well:
parent.someFunction();
I'm not sure about manipulating a parent's cookie(s) from a child frame, but your post it seems like all you need to do is store and submit a value. You won't be able to do it with just PHP.
精彩评论