Reputation: 99
I want to Get a url of popUp window And Show It in Parent window.
<a href="#" onClick="MyWindow=window.open('http://www.google.com','MyWindow',width=600,height=300); return false;">Click Here</a>
I Want to show popurl i.e google.com in parent window.
Upvotes: 1
Views: 3594
Reputation: 5601
If the popup is from a third party domain (such as google.com), then you can't access the location.href property of the popup because of the "same origin policy".
If it's in the same domain, then you can get the URL by doing this on the parent window:
popUpWindow.location.href
Upvotes: 1
Reputation: 3729
You can call a function onclick and have the url there as a variable:
<a href="#" onclick="my_function()">Click Here</a>
And then you can do anything you want with the url:
function my_function()
{
var url = 'http://www.google.com';
window.open(url ,'MyWindow',width=600,height=300);
//show the url in an element
return false;
}
Upvotes: 0