GET Parameter

The getParameter() method is one of the HTTP request methods that is most often used to request resources from a server through a client like a browser. Since the transmitted page contents or files are requested using URLs, indication of URL parameters is also important.

General information

Communication between clients and servers on the Internet mostly takes place via the HTTP protocol (Hypertext Transfer Protocol). This enables a data exchange via request and response. A client could, for instance, be a user’s web browser; the server provides a HTML page that is loaded by the user’s browser. The two most commonly used methods to enable this kind of communication are GET and POST.

GET request

If a client uses the HTTP protocol on a webserver to request a certain resource, the client sends the server certain GET parameters through the requested URL. These parameters are pairs of names and their corresponding values, so-called name-value pairs. These are added to the URL with a “?” sign and tell the server which resources are meant. The name and value are always separated using an “=” sign.

The syntax is as follows:

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

Not just single but also multiple parameters as well as entire lists can be transmitted to the server. Here, the various parameters are separated using an “&” sign.

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

If the request is syntactically correct, the server sends a response. This initially contains certain status information about the request. This can, for instance, be whether or not the requested resource is available or when the request was made. The server does not first send the resource to the client but rather tells the client where the resource can be found. The browser then follows the instructions and asks for the resource from the server. This is when the browser finally 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. Every request only receives one response.

Comments on the GET parameter

Requests using the getParameter() have certain properties and disadvantages.[1] 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

  • Caching of the browser is possible
  • Preservation in the browser history
  • Saving as a bookmark is possible
  • Unsuitable for use with sensitive files
  • Length limitation (URL length)
  • Its primary purpose is to obtain data

Practical relevance

URLs with parameters are also referred to as dynamic URLs. By changing the parameters, a new URL results and the page contents can change dynamically. For example, if an online shop 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’s URL also requests for the changed content using the GET parameter.

Importance for search engine optimization

The emergence of dynamic URLs when using getParameter() also has disadvantages. Through the dynamics, it can happen that partly similar content is generated on several URLs. Duplicate content that results in this way has a negative effect on the ranking of the pages, which is why there are certain necessary measures to undertake from a SEO perspective. It is advisable to use the canonical tag such that the search engine crawler ignores the duplicate pages wth the parameter-URLs. With the Google Search Console, parameters from Crawling are excluded. Through this, SEOs and Webmasters can optimize the Crawl Budget of the Googlebot.

A further aspect that becomes important through the use of the getParameter is the readibility of the URL. The parameters in the URL are usually cryptic for the user and doesn't mean much. For this reason, URLs with parameters should ideally be redirected to URLs without the corresponding parameter.

References

  1. HTTP Methods: GET vs. POST w3schools.com. Accessed on 05/08/2015

Web Links

Category

Related Articles