Understanding URLs: Fragments

This and the other “Deck” posts are a repurposing of flashcard study decks to Q&A blog posts.

What is a URL fragment?

It is a hash containing a single value appended to a url.

What is a URL fragment used for?

A fragment is used to identify locations on a page. It can be used to direct users further down on a page where the information they are looking for resides.

Is a URL fragment sent to the server?

No, a fragment is understood and used by the browser only.

When would you use a fragment vs query parameter?

You would use a fragment when you need to scroll the page to a certain section of content, you would use a query parameter to filter specific elements in a collection of data.

What is the syntax for using a URL fragment?

The fragment begins at the # and contains a single value. devdecks.io/about#founding-team or devdecks.io/about#contact-details (these are non functioning examples).