A method="get"
attribute value specifies that the form data will be submitted as name/value pairs on the query string.
It is sent using the HTTP GET method.
A method="get"
on a <form> tag.
Enter data, submit, and notice the name/value pairs on the url (browser command line).
<form action="/tutorial/action.html" method="get">
<fieldset style="background: #f6f8ff; border: 2px solid #4238ca;">
<legend>Address Information</legend>
<input type="text" name="street" placeholder="Street"><br /><br />
<input type="text" name="city" placeholder="City"><br /><br />
<input type="text" name="country" placeholder="Country"><br /><br />
<button type="submit">Submit</button>
</fieldset>
</form>
The method attribute specifies the method to use for form submission.
The method="get"
value sends form data to the server by appending it to the page request.
This method is mostly used when requesting data from the server which requires certain parameter or queries.
<form method="GET">
Only one element uses the method attribute with the get value.
Elements | Description | |
---|---|---|
<form> | Specifies an HTML form -- see example above |
Data is easily visible on the url
Data remains in the browser history
Data and associated query can be cached and reused
The query can be bookmarked
The GET method is used to request data -- not modify it
Data should never include sensitive information such as passwords, credit card data, and more
Data size is restricted to up to 2048 chracacters only
Cannot be used to send binary data such as images, files
Less secure
Here is when method support started for each browser:
Chrome
|
1.0 | Sep 2008 |
Firefox
|
1.0 | Sep 2002 |
IE/Edge
|
1.0 | Aug 1995 |
Opera
|
1.0 | Jan 2006 |
Safari
|
1.0 | Jan 2003 |