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?
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?
Share Improve this question asked Nov 30, 2009 at 19:00 SurfingCatSurfingCat 1514 gold badges5 silver badges12 bronze badges3 Answers
Reset to default 4In the popup, add this to the onclick event of your link:
window.opener.location.href = "link_in_old_window.htm";
Not that I know of... CORRECTION: I think you can use the window.opener
property.
However, you may have better luck using something that loads the popup in the context of the current page using AJAX. In this case, since you're still on the main page, you have access to any javascript on that page. So for example, you can popup a window, capture the click event without that window, close the popup window dynamically, and then change the current page location.
I've done this using Smoothbox but Thickbox or others can acplish the same task.
You can also check out the opener
property.
http://www.webreference./js/tutorial1/opener.html