I have a click handler for a specific link, inside that I want to do something similar to the following:
window.location = url
I need this to actually open the url in a new window though, how do I do this?
You just need an anchor ( <a> ) element with three important attributes: The href attribute set to the URL of the page you want to link to. The target attribute set to _blank , which tells the browser to open the link in a new tab/window, depending on the browser's settings.
Using Right Click. Right click on the link on your current window. Choose Open in New Window . The page will open in a new window.
You can like:
window.open('url', 'window name', 'window settings')
jQuery:
$('a#link_id').click(function(){ window.open('url', 'window name', 'window settings'); return false; });
You could also set the target
to _blank
actually.
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