I have a couple of Pop-Ups which contain links. These links should self close the Pop-Up, and then open up a new browser window to follow the link. I’m using the following function - but where do I specify that a new browser window should be used when someone clicks on the link (basically like a target: blank)?
function goAndClose(url) {
opener.location.href = url
this.close;
}
Thanks for your input! Yeah, I’m also not a fan of pop ups, but in this case it’s how the client wants it: its actually an image gallery. Each image opens up in a pop up and has a link underneath - to an external website.
Clicking this link should close the pop up and open up the website in a new browser window…
Sorry, but do you mind giving me a code example? I’m not really good in JS and cant get it right
This worked in IE6. and opened the new page in FF. I didn’t open a popup to use it but it will work better with one.
<script language="javascript" type="text/javascript">
<!--
function goAndClose(page) {
window.open(page);
window.close(name_of_Popup);//insert the name of the popup
//window here. will only work properly if popup was created with window.open.
//havent gotten it to work in ff but I started with the window to be closed
//didnt open a popup to start...
}
</script>
<a href="javascript:void();" onclick="goAndClose('http://www.google.com/');">Google</a>