HTTP header you probably don’t know — Clear-Site-Data

Photo by Joshua Sortino on Unsplash

The hypertext transfer protocol also known as HTTP is the protocol for the web. Every time you communicate through the browser, a request is sent to a server over the HTTP protocol. You have probably heard of some of the other protocols like method, Content-Type, or User-Agent, but HTTP has many more headers you can use.

Clear-Site-Data is a header you can use the clear the data for your site (what a great name!).

When using the Clear-Site-Data header you have 5 options to choose from.
Every option is based on the origin of the response URL.


When you want to clear the browser cache data. That could be scripts, images, cached icons


When you want to clear all the cookies for your site. That could be useful if you for example have an auth cookie.


When you want to remove all the data from the DOM storage. That is not only localStorage but also sessionStorage, IndexedDb, service worker registrations, AppCache, WebSQL databases, FileSystem API data, and plugin data.

“execution contexts”

When you want to reload the site.


The wildcard option is a combination of the other four options, and is just a shorthand to say to the browser “Just clear everything you got. Wipe it all!”.


A common way to use this header; is when a user logs out of your web application. Then you can send for example the ‘cookie’ option and that will clear the cookies for the browser without involving any Javascript.

Another use case could be if you have some aggressive caching strategy and want to reload all the styles and images on your site, then you can send the “cache” option and you are good to go!.


This header is not supported on Internet Explorer or Safari. The executionContext option is only supported on Samsung Internet and specific versions of Firefox, so be careful before implementing it.

Hope you find it useful!




Senior Frontend Developer at EazyProject A/S

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium


What Are The Exclusive Features Of OpenSea Clone Script?

Active Record Validations

FIWARE supports Smart City beach surveillance in Montevideo

Agile Philippines Meetup 2017.06

Git and GitHub (Part-1)

Announcing Foxglove for Teams

Making it Miniature: Integrating the ATtiny85 in your Arduino Project

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Kasper Due

Kasper Due

Senior Frontend Developer at EazyProject A/S

More from Medium

Pair Programming: Weather the Storm

Understanding Pair Programming, Why 2 Minds Are Greater Than 1.

An illustration showing how pair programming works in the workplace.

Destructuring and Optional Chaining

Everything you should need to know about Node JS