When you open a Web page from URL What is the HTTP method used by your browser to send the initial request to the server?

When you open a Web page from URL What is the HTTP method used by your browser to send the initial request to the server?

Maneesa Wijesinghe-Nelken

Apr 26, 2017

7 min read

If you are in any technical profession, I am sure someone at some point has asked you this question. Whether you are an engineer, developer, marketer, or even in sales, it is always good to have a basic understanding of what is going on behind our browsers and how information is transferred to our computers via the internet.

Improve Article

Save Article

In this article, we will learn the HTTP method to send the form data. Before diving into this topic, we need to know what exactly is the HTTP method and how many HTTP methods available. 

What is HTTP?

The HTTP stands for HyperText Transfer Protocol. It is used to communicate between clients and servers. It works on a request-response protocol between client and server. The client sends a request to the server. The server accepts the request and returns a response to the client. It can be information about the request and requested content. 

These are the following most commonly used HTTP methods. 

  • GET
  • POST

After validation of the form on the client-side, It is ready to submit the form. After submission, the form data send to the server using the GET method and the POST method. Once we will use the GET method to send the form data to the server then we will use the POST method to send the form data to the server. In the end, we will understand the difference between both HTTP methods that are used to send the form data. 

Sending the form data using the ‘GET’ HTTP method: The GET method is used to request data from specified resources. It sends an empty body to the server and asks to get resources. If the form data is sent using the GET method the data sent by the server is appended to the URL of the page. Its requests have some length restrictions. It is not used for modification. 

Example: 

HTML

<!DOCTYPE html>

<html>

<body>

    <h2>Send data using the 'GET' HTTP method</h2>

    <form action="" method="get" target="_blank">

        <label>User Name:</label>

        <input type="text" id="username" 

            name="User Name"><br><br>

        <label>Password:</label>

        <input type="password" id="password" 

            name="Password"><br><br>

        <input type="submit" value="Login">

    </form>

</body>

</html>

Output:

When you open a Web page from URL What is the HTTP method used by your browser to send the initial request to the server?

Sending the form data using the ‘POST’ HTTP method: The POST method is used to send data to a server to create and update a resource. The requested data using the POST method is appended to the body of the HTTP request rather than the page URL. Its request has no restrictions on data length. 

Example:

HTML

<!DOCTYPE html>

<html>

<body>

    <h2>Send data using the 'POST' HTTP method</h2>

    <form action="" method="post" target="_blank">

        <label>User Name:</label>

        <input type="text" id="username" 

            name="User Name"><br><br>

        <label>Password:</label>

        <input type="password" id="password" 

            name="Password"><br><br>

        <input type="submit" value="Login">

    </form>

</body>

</html>

Output:

When you open a Web page from URL What is the HTTP method used by your browser to send the initial request to the server?


When you open a Web page from a URL What is the HTTP method used by your browser to send the initial request to the server?

Browser initiates TCP connection with the server. Browser sends the HTTP request to the server. Server processes request and sends back a response. Browser renders the content.

Which HTTP method you will used to send data via URL?

Sending the form data using the 'GET' HTTP method: The GET method is used to request data from specified resources. It sends an empty body to the server and asks to get resources. If the form data is sent using the GET method the data sent by the server is appended to the URL of the page.

What type of HTTP request is usually used to access a website?

GET is used to retrieve and request data from a specified resource in a server. GET is one of the most popular HTTP request techniques. In simple words, the GET method is used to retrieve whatever information is identified by the Request-URL.

When a web browser requests a page the browser uses HTTP to send a request via TCP to the Web server?

What is HTTP? HTTP stands for Hypertext Transfer Protocol and is used to structure requests and responses over the internet. HTTP requires data to be transferred from one point to another over the network. The transfer of resources happens using TCP (Transmission Control Protocol).