Getting form data and sending it to a new tab in the browser
Hi am creating a small form where you can place postcodes to get directions, it then sends this data with the URL of Google maps with the postcode in it to show the directions.
I was wondering is it possible to somehow get thenew URL i开发者_如何学Go have into a new browser tab / window.
The idea is that the user input the postcodes and then presses 'Submit' which then takes them to a new browser tab / window with the new URL in it.
Thanks
The simplest thing to do is to put "target=_blank" in your <a>
tag or your <form>
tag.
<form action='/your/url' target='_blank'>
whatever
</form>
or for simple clickable links:
<a href='/some/new/page' target='_blank'>click me</a>
Now, you can't really control whether that's a new page or a new tab. You can try to force it to be a new page by doing it with Javascript and calling "window.open()".
精彩评论