Sharing, Links & Measurement

URL Fragment

Definition

The fragment, also called the hash or the anchor, is everything after the first hash character in an address. Traditionally it names an element id in the document, so a fragment reading methods scrolls to the element whose id is methods once the page has loaded. PDF viewers extend the idea with their own syntax, where page=12 opens a document at page twelve in most browsers. Single-page applications have long used fragments as routes, producing addresses that change what is displayed without a new request. The defining property is that the fragment stays in the browser: it is not part of the HTTP request, so no server, log or access rule ever sees it.

Why It Matters

A fragment turns a long document into something you can point at precisely. Sending a ninety-page PDF with a page number in the fragment saves the reader four minutes of scrolling and removes an email asking which section you meant. But because the fragment never reaches the server, you cannot count how many people used it, cannot protect anything with it, and cannot make the host behave differently because of it. Treat it as a hint to the browser: useful, free, and entirely public.

How It Works

The browser splits the fragment off before it builds the request. It resolves the host, sends GET with the path and query string only, receives the document, and then looks for a matching target inside it. In HTML that means an element whose id or name equals the fragment text, which the browser scrolls into view; a little CSS scroll-margin stops the heading disappearing under a fixed header. In a PDF the viewer parses parameters such as page, zoom and nameddest. If nothing matches, the browser stays where it is and reports no error at all, which is why a broken fragment is easy to miss. Changing the fragment from JavaScript updates history without reloading anything.

Real-World Example

A policy team publishes a 120-page consultation at civic-consultation.99helpers.site/document.pdf and emails every department the same address with a different fragment — page fourteen for planning, page sixty-one for transport. Each recipient lands on their own section in the browser's PDF viewer. The host serves one identical file to all of them, because the fragment never left the reader's machine.

Common Mistakes

  • Expecting analytics to report fragments — the server never receives them, so section-level traffic has to be measured in the page itself
  • Using a fragment as a secret — it is visible in the address bar and in browser history, and it offers no protection whatsoever
  • Linking to a page number without checking the viewer — some in-app and mobile PDF viewers ignore the parameter and open at page one

Related Terms

Put a file online in seconds

Drop in a document, an image, a page or a whole static website and share the link — free, with no build step and no server to set up.

Host a file free →