CSE 134B Web Client Languages
  1. Interaction
  2. Linking

Interaction · Layer 3

Linking

The link is the web's first interaction and still its most common one. It is also where the web's three foundations meet: an href is a URL, following it is an HTTP request, and the <a> element is HTML. These pages treat the link as all three, from the markup to the request it sends, what comes back, and whether the person following it can trust where it goes.

  • A link goes somewhere; a button does something. Every link is a real <a href>, and nothing a link does ever changes data.
  • Following a link is a request. The pages show what it sends, using /api/echo, which replies with exactly the request it received.
  • A link is a promise about its destination. Its text says where it goes, its address is honest, and it keeps working.
  • The browser already does most of the work. New tabs, history, the back button and keyboard access come free with real links; a script that takes a link over has to keep all of them working.

Demos use the /go/ addresses on cse134.site, which answer with every kind of redirect, a missing page and a download, so you can watch each one in DevTools.

The pages

  1. 01The link

    Hypertext and the <a> element, links around blocks, link text as the link's name, and link versus button.

  2. 02Where a link goes

    How an href resolves, absolute and relative links, <base>, fragments and text fragments, and schemes such as mailto: and tel:.

  3. 03What a click does

    The request a link sends, the Referer header and referrer policies, redirects and other answers, new tabs and the opener, downloads and pings, history, and faster clicks.

  4. 04Links between documents

    <link rel> and rel on links: stylesheets and icons, canonical and alternate pages, preloading, and the values search engines read.

  5. 05Links people can use

    Link text that makes sense alone, links that look like links, focus and skip links, new windows and files, image links and image maps.

  6. 06Links you can trust

    Reading a URL before following it, short links, tracking parameters, link rot, embedding with <iframe>, and where JavaScript takes links next.