I would like to close the current popup, open a new window (tab) and redirect to a specific link. This works extremly easy with my <a>
links. I simply add "target="_blank"" and it works just fine (it doesnt close the pop up actually, but minimizes it and thats fine too).
Since I am using some buttons with a onclick function, I want to implent the "target="_blank" in the button somehow... The button looks like this at the moment:
<input type="button" onclick="parent.window.opener.location='http://google.com'; window.close();">
This works, but the problem is that it redirects in the parent window and doesnt open a new window...
Any1 has an idea how to get the feature of "target="_blank" so that a click on button will open a new window and than redirect instead of redirecting the parent window?
Why not just use this in your onclick:
<input type="button" onclick="window.open('http://google.com'); window.close();" />
$('#button').click(function(e)
{
e.preventDefault();
window.open('http://www.facebook.com/','_blank');
});
<input type="button" id="button" value="Go facebook">
It works un IExplorer, Firefox, Chrome, Opera and Safari
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With