Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retrieve URL from popup after...

Status
Not open for further replies.

yahve

Programmer
Nov 14, 2000
159
CA
Hi,

Is it possible to retrieve the URL of a popup window from the opener window after the popup has been used to navigate to a different server? If the user uses the popup to navigate several differnet pages on different servers, can I retrieve the URL from the window that originaly opened the popup?

Thanks.
 
Explain what you mean exactly.
Do you mean a popup that you code by yourself or a popup that you get when you surf on the net?

If it is a popup of yourself I think it's only possible when you navigate to a different site in a new browser window (target="_blank") and not in the popupwindow?

I hope this is what you mean, put this in your code of your popupwindow-page:

<body>
<script language=&quot;javascript&quot;>
function openLocation(url)
{
window.opener.location=url;
window.close();
}
</script>
<center>
<a href=&quot; target=&quot;_blank&quot;>surf</a><br>
<a href=&quot;javascript:eek:penLocation('original.htm');&quot;>Original Site</a><br>
<a href=&quot;javascript:window.close();&quot;>Close</a>
</center>
</body>

By the way, if you can make it that you surf to another page in a sort of inline frame in your popup-window then you can put this link &quot;Original site&quot; under it.

Hope this helps you,
Erik
 
If the url is not in the same domain you will not be able to get it. You'll get a security violation instead. This is to protect people's privacy. How would you like someone to track where you went in one window from another one? I'm not saying that you're trying to do something wrong, just that that's the reasoning for this security rule. Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Hi Tracy,

You've got it! That is exactly the type of error I'm getting. What I need to do is this: from our site, visitors must go to another site (like mapblast) and find their exact location. Once they have it, they need to submit it to a server-side script on my site, so that I can perform the service we offer. I've written an hta that can retrieve the URL from the second windows and pass it to a script on the server thru the fist window. But, this has it's limitation: user are promt to allow the application to run.
Do you know of any other way I could achieve this operation?

Thanks.
 
An hta is the only way that you can handle this simply. The &quot;same domain policy&quot; security restriction is pretty tight, and I don't know of any other simple way around it.

The only way I can think of that you might be able to do something like that is by using a cgi program to fetch and display the other site's pages, modifying them before displaying them to interface with YOUR cgi program, and allowing your cgi program to intermediate between the user and the other site. Sounds pretty hairy, but it could be done. The perl LWP module can handle the communication with the other site easily enough. Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top