What happens when you click a link?

What happens when you click a link? So, when you click on a link,  there are three things that can happen.

What happens when you click a link?

1. Simple Action with url and no javascript of any other such language involve, also no css is involved. 

At a high level, when you click on a link, your browser and operating system figure out where you’ve clicked.  The web page that you’re viewing has hidden information associated with whatever you clicked on.  That’s called a Uniform resource locator(URL).  That indicates the next web page that you want to view.

what happens when you click a link
taken from http://www.clipartkid.com/images/26/what-is-a-hyperlink-with-pictures-UDZ66a-clipart.jpg

Embedded inside of the URL is the name of the web site that holds the page that you’ve asked for.  Your browser takes that URL, breaks out the name of the web site, and then uses the Domain Name System (DNS) to get an Internet Protocol (IP) address for the site.

Your browser then opens a Transmission Control Protocol (TCP) connection to the web site over IP.  It asks to speak to the Hypertext Transfer Protocol (HTTP) server (or, for secure connections, HTTPS) which then provides the next web page in HyperText Markup Language (HTML) that your browser renders.

2. If css is involved

When CSS is involved in this scenario it will tell the browser to make changes to some elements. CSS is responsible for how your site looks and what element looks at what position.

So with the involvement of css, only sites view part can be changed like changing the size of element, color of text, hiding an element or showing any animation. 

3. If there is involvement of Javascript or any other such language.

You click is an action for these languages. Your action is mapped to an action handler which contains the code or tell the browser what to do on click of this link.

With the power of Javascript the browser can act in many way with response to the click.

It can open a new page, move some elements here and there, make a request to server for dynamic data or may be close the dialogue box.

End of Article. 


Gaurav Yadav

Gaurav is cloud infrastructure engineer and a full stack web developer and blogger. Sportsperson by heart and loves football. Scale is something he loves to work for and always keen to learn new tech. Experienced with CI/CD, distributed cloud infrastructure, build systems and lot of SRE Stuff.

1 COMMENT
  • telkomsel
    Reply

    Good answer back in return of this issue with firm arguments and explaining all regarding that.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.