Skip to main content

Get parameter




The getParameter () method is one of the most widely used HTTP request methods to request resources from a server through a client, such as a browser. Since the contents or files of the page transmitted are requested by means of URL, it is also essential to indicate the parameters of the URL.

General information

Communication between clients and servers on the Internet is carried out mainly through the HTTP protocol (Hypertext Transfer Protocol). This enables a data exchange by request and response. A client could be, for example, a user's web browser; the server provides an HTML page that is loaded by the user's browser. The two most widely used methods to allow this type of communication are GET and POST.

GET request

If a client uses the HTTP protocol on a web server to request a certain resource, the client sends certain GET parameters to the server using the requested URL. These parameters are pairs of names and their corresponding values, the so-called name-value pairs. These are appended to the URL with a "?" and it tells you to sign and tell the server what resources you are referring to. The name and value are always separated by the "=" sign.

The syntax is as follows:

http://www.domain.com/index.html*?name1=value1

Not only individual parameters, but also various, as well as complete lists, can be transmitted to the server. In this case, the different parameters are separated by the sign "&".

http://www.domain.com/index.html*?name1=value1&name2=value2

If the request is syntactically correct, the server sends a response. Initially, it contains some status information about the request. This can be, for example, if the requested resource is enabled or not or when the request was made. The server does not send the resource to the client first, but tells it where the resource can be found. The browser follows the instructions and requests the resource from the server. At this point, the browser briefly loads the resource based on the location-based information provided to it by the server. The reason for this is that the HTTP protocol only allows one-way communication. Each request only receives one response.

Comments on the GET parameter

Requests that use getParameter () have certain properties and disadvantages. Since the data is transmitted via the URL, it is advisable to only use the GET parameter to request files that are not security relevant.

The following properties characterize the GET parameter

  • Browser caching is doable
  • Preservation in browser history
  • It is possible to save as a favorite
  • Not suitable for use with sensitive files
  • Length limitation (URL length)
  • Its main purpose is to obtain data

Practical relevance

Parameterized URLs are also known as Dynamic URLs. By changing the parameters, we get a new URL and the content of the page can change dynamically. For example, if an online store has added products on a category page and a user loads this page using a browser, the new products will also be displayed, since the page URL also requests the modified content using the GET parameter.

Importance for search engine optimization

The appearance of dynamic URLs when using getParameter () also has disadvantages. By means of dynamics, it can happen that partially equivalent content is generated in several URLs. The duplicate content that results has a negative effect on the ranking of the pages, so there are certain essential measures to take from an SEO perspective. It is advisable to use the canonical tag so that the search engine crawler ignores duplicate pages with the-URLs parameter. With the Google Search Console, Crawling parameters are excluded. Through this, SEOs and Webmasters can make the most of Googlebot's crawl budget.

Another aspect that becomes important through the use of the getParameter is the readability of the URL. URL parameters are generally cryptic to the user and don't mean much. For this reason, the ideal is to redirect the URLs with parameters to URLs without the respective parameter.

HTTP Methods: GET vs. POST w3schools.com. Retrieved 2015-05-08.

Collect GET parameters in JavaScript Victor Robles' Blog

Web Links

R Marketing Digital