Been working on this since yesterday, having no success. I need to get the URL of a parent window into a form field on a child window so that I can send it along with customer from the form. Can anyone tell me how this can be done? I'd prefer it be done with PHP because I'm getting familiar with that.
Please and thanks.
If I did this on the parent page would it stor the parent's URL so that I could retreive it later?
<?php
$_SERVER['PHP_SELF'];
?>
and then to recall it on child perhaps:
if(!empty($_SERVER['PHP_SELF'])){
$link = $_SERVER['PHP_SELF'];
}else{
$link = "No URL submitted.";
}
is this about iframes
?
If so, then:
parent.document.location.href
- to get url of the document where the iframe is placed
top.document.location.href
- get url of the document, whose url is in the address field of the browser
var childPopup = window.open(); var childForm = childPopup.document.createElement('form'); childForm.setAttribute('action', 'serverurl'); childForm.setAttribute('method', 'POST'); childPopup.document.body.appendChild(childForm); var childText = childPopup.document.createElement('input'); childText.setAttribute('type', 'text'); childText.setAttribute('value', document.location.href); childForm.appendChild(childText);
This is an example of Javascript that gets the URL of the parent window into a form field of the child window. Then this URL will be sent to the server as a parameter when the form is submitted.
have been working all day at this. apparently found at get parent.location.url - iframe - from child to parent
so you need <iframe src="http://your-site.com/framepage.php?parent=http://parentpage.com">
and in framepage.php (or whatever u has)
echo $_GET['parent'];