Search code examples
javascriptpopuponclickwindowparent

Disable Parent Window after open.window


I want to link to an amazon music preview player as an popup from my site. I have this code:

<a href="http://www.amazon.de/gp/recsradio/radio/B000002OK3/" target="_blank" onclick="window.open(this.href,'popper','scrollbars=1,width=900,height=600'); return false;" onkeypress="window.open(this.href,'popper','scrollbars=1,width=900,height=600'); return false;">Link</a>

My Problem is, when I click on the Album Cover in the Amazon Popup, my parent site with the link refreshs with the target Amazon url. When I open the Popup URL by typing the url in the adressbar and then click on the cover, a new window is opend with the target url (this is what I want to force).

Is it possible to don't pass the parent relation with the link popup window?


Solution

  • I solved my Problem using something like this:

    Open a local popup.php from my site with JS while passing amazonurl as var.

    <a onkeypress="window.open(this.href,'popup','scrollbars=1,width=900,height=600'); return false;" onclick="window.open(this.href,'popper','scrollbars=1,width=900,height=600'); return false;" rel="nofollow" target="_blank" href="http://domain.com/popup.php?amazonurl=http://[...]">Link</a>
    

    In popup.php I use

    <script language="javascript" type="text/javascript">  
    window.opener = null; window.location.href = "<?php echo $_GET['amazonurl']; ?>;</script> 
    

    To make windpw.opener = null and then refresh the popup with the amazon URL.