Can a local page accept text value and open new tab at Internet URL with value as parameter?
-
20-06-2021 - |
Frage
An Internet site has URL like www.manyresultpages.net/cgi-bin/search.cgi?recnum=7777&
Can I make my Dad a local static html page (for his PC) with one input field and a submit button, that will modify the above URL, replace "7777" with the input text and open the new URL in a new tab on button click?
I'm HTML-challenged, googled for 45 mins without getting far. Did learn jsfiddle.net is down. Can load jQuery if that would help.
Lösung
Yes. Use method="get"
in the form to place the form data in the URL, use an input field with name="recnum"
to get the right name for the form data, and use target="_blank"
in the form to open the page in a new window/tab:
<form method="get" target="_blank">
<input type="text" name="recnum"/>
<input type="submit"/>
</form>
Note that you can't control whether the page is opened in a new window or a new tab, as that is a user preference in the browser.