Jump to content

Passing a value from child to parent window isn't working


miseleigh

Recommended Posts

We're trying to pass a link from a child window to the parent window after we upload a file. For some reason, the javascripts below don't even seem to be running, although all the values are filled in correctly after the php is done.  The only thing we can think of is that the child loses its window.opener after processing its own form.  Essentially, the parent calls the child, then the child processes a form to upload a file, and the child is then supposed to fill in a link to that document.

<SCRIPT type="text/javascript">
window.opener.document.<?php echo $ret_field;?>.value = "<?php echo $link;?>";
window.close();
</SCRIPT>

The child page uploads eveything properly, but then does not close and does not fill in the value on the parent.  Thanks for any help.

Link to comment
Share on other sites

Well, we've figured out it's a cross-domain problem...

and that a work-around for that is plug an iframe into the child that's located on the parent's domain.  But how do we use that work-around in order to fill a field on the parent page?

Link to comment
Share on other sites

We solved it by using an intermediary page on the parent domain that does the javascripts after getting values from the child page.  Just a warning to anyone else trying this: whether it's http or https, or whether the www is present or not, makes a difference to javascript- they must be alike before and after for js to recognize it as the same domain.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.