PDA

View Full Version : Get child window url in parent window



cristopher
05-18-2012, 11:47 AM
Hello,


I use window.open() to open third party url in pupop window. Now i want to identify the url of my child window change or not in my parent window code.

How can i do it please help me.

I use below code for open window.

<script>
var windowObjectReference;
var strWindowFeatures = "menubar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes,outerWidth=1200,width=500,innerWidth=800";
var PreviousUrl;

function openurl(url)
{
PreviousUrl = url;

if(windowObjectReference == null || windowObjectReference.closed)
{
windowObjectReference = window.open(url, "mywindow",strWindowFeatures);
windowObjectReference.focus();
}
else if(windowObjectReference.document.location != url)
{
windowObjectReference.close();
}
}
</script>

I want to close child window on change of child url.


help me please.

Thanks in advance.
crish

phpfinder
05-19-2012, 01:22 AM
I am not sure whether you can do it.


I always do this type of things by iframe. It is easy to conduct each other in parent or child window.


If you want conduct in totally non-relative windows. May be you can't just use javascript.