URL

Share

A URL is a text code like this: https://www.example.com/search.php?q=cool%20books&p=2#results. It's used by a web browser to figure out how to access web page and works like the online address of something on the internet (URL stands for Universal Resource Locator). Technically, a URL isn't necessarily a web page, it can be the address of an JPG image file, for example, it can be used by more than just web browsers, and it doesn't even need to be the address of something on the internet, but in general, that's what a URL is.

The type of URL used by a browser is composed of several parts:

  1. The protocol, which is http or https. The browser needs this to figure out how to connect to the web server.
  2. The domain name, e.g. www.example.com. The browser needs this to figure out where the web server is on the internet: it will figure out its IP address using DNS.
  3. The path to the resource on the server, e.g. /search.php. This looks like a file path and it could actually mirror the file system on the server, but that's entirely up to the server.
  4. A query, e.g. ?q=cool%20books&p=2. Normally these are key=value parameters that are passed to a script file in the server, but, again, this depends on the server. Query values that you type can be percent-escaped, e.g. a space becomes %20.
  5. A fragment identifier, e.g. #results. This refers to an element on the web page. When a web browser accesses a URL with a fragment, first it opens that web page, then it searches the web page to see if it has an element with a matching identifier, and if it does, it automatically scrolls down to that part of the page.

Typing a URL in some websites automatically creates a link.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *