开发者

Getting form data and sending it to a new tab in the browser

开发者 https://www.devze.com 2022-12-22 00:00 出处:网络
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.

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()".

0

精彩评论

暂无评论...
验证码 换一张
取 消