Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaScript PopUp - Link target from Popup = other Window of browser

i open a html page with a js popup

<script language="javascript" type="text/javascript">
<!--
function popitup(url) {
    newwindow=window.open(url,'foobar','height=575,width=950');
    if (window.focus) {newwindow.focus()}
    return false;
}

// -->
</script>

<a href="index.php" onclick="return popitup('foobar.html')">Link to popup</a>

Now I got some Links in my Popup and I want to close the Popup onclick of my link AND OPEN LINK IN THE OLD WINDOW. With old window I mean the browser window who calls the popup. Is this possible?

like image 572
SurfingCat Avatar asked Oct 14 '22 12:10

SurfingCat


1 Answers

In the popup, add this to the onclick event of your link:

window.opener.location.href = "link_in_old_window.htm";
like image 164
Pekka Avatar answered Oct 26 '22 23:10

Pekka