Reputation: 151
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?
Upvotes: 5
Views: 11208
Reputation: 6354
You can also check out the opener
property.
http://www.webreference.com/js/tutorial1/opener.html
Upvotes: 0
Reputation: 449673
In the popup, add this to the onclick event of your link:
window.opener.location.href = "link_in_old_window.htm";
Upvotes: 4
Reputation: 4277
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 accomplish the same task.
Upvotes: 0