ScriptingWebWeb Technologies

Understanding how URLs are linked to Code in the HTML pages

Whenever we launch a website in the browser, it then gets modified as we navigate the other elements on that web site page. 

We notice that, the modified URL will mostly have the website actual website but with more strings attached to it starting with a ?.

Example:

We open a main web site  page say http://www.yahoo.com/

image

Then we navigate to Yahoo mail login page: https://login.yahoo.com/?.src=ym&.intl=us&.lang=en-US&.done=http://mail.yahoo.com 

image

 

In the above we see the web site of yahoo.com is having URL with

 

https://login.yahoo.com/  

+  ?  +

.src=ym&.intl=us&.lang=en-US&.done=http://mail.yahoo.com

 

This process of URL modification is called the URL encoding.  This is needed for client browsers to send the information to web server to load appropriate pages.  In this scheme, name/value pairs are joined with equal signs and different pairs are separated by the ampersand.

name1=value1&name2=value2&name3=value3

Spaces are removed and replaced with the + character and any other nonalphanumeric characters are replaced with a hexadecimal values. After the information is encoded it is sent to the server.

 

There are two ways the browser client can send information to the web server.

  • The GET Method
  • The POST Method

The GET method sends the encoded user information appended to the page request. The page and the encoded information are separated by the ? character.

http://www.abcd/index.htm?name1=value1&name2=value2

 

The POST method transfers information via HTTP headers. The information is encoded as described in case of GET method and put into a header called QUERY_STRING.

 

References:

Advertisements