The clear-site-data header allows a website to clear data stored in a web browser, giving web developers more control over data stored by their website in the client’s browser.

The clear-site-data header accepts one or more directives which are described below

“*” – The wildcard directive, meaning all data should be cleared.

Clear-Site-Data: "*"

“cache” – This directive instructs the web browser to delete all locally cached data.

Clear-Site-Data: "cache"

“cookies” – This tells the browser to remove all cookies for the origin on the response URL.

Clear-Site-Data: "cookies"

“storage” – You use this directive to tell the web browser to delete all data from storage mechanisms in the browser such as localStorage, sessionStorage, indexedDB, Service worker registrations, Plugin data , and the FileSystem API data.

Clear-Site-Data: "storage"

“executionContexts” – This directive prompts the web browser to refresh or reload all browsing contexts associated with the specified origin URL.

Clear-Site-Data: "executionContexts"

An example header which includes all of the directives above will look like this

Clear-Site-Data: "cache", "storage", "cookies", "executionContexts"

With these explanations and examples, I hope the Clear-Site-Data Header is no longer a mystery to you.

Categorized in: