I would like to have a button that redirects to a given URL and opens in a new tab. How can this be done?
You can forget about using JavaScript because the browser controls whether or not it opens in a new tab. Your best option is to do something like the following instead:
<form action="http://www.yoursite.com/dosomething" method="get" target="_blank">
<input name="dynamicParam1" type="text"/>
<input name="dynamicParam2" type="text" />
<input type="submit" value="submit" />
</form>
This will always open in a new tab regardless of which browser a client uses due to the target="_blank"
attribute.
If all you need is to redirect with no dynamic parameters you can use a link with the target="_blank"
attribute as Tim Büthe suggests.