docs.rodeo

MDN Web Docs mirror

Clear-Site-Data

{{securecontext_header}} {{HTTPSidebar}} 

The HTTP Clear-Site-Data {{Glossary("response header")}}  sends a signal to the client that it should remove all browsing data of certain types (cookies, storage, cache) associated with the requesting website. It allows web developers to have more control over the data stored by browsers for their origins.

Header type `{{Glossary("Response header")}}` 
`{{Glossary("Forbidden header name")}}`  No

Syntax

// Single directive
Clear-Site-Data: "cache"

// Multiple directives (comma separated)
Clear-Site-Data: "cache", "cookies"

// Wild card
Clear-Site-Data: "*"

Directives

[!NOTE] All directives must comply with the quoted-string grammar. A directive that does not include the double quotes is invalid.

Examples

Sign out of a website

If a user signs out of your website or service, you might want to remove locally stored data. To do this, add the Clear-Site-Data header to the page that confirms the logging out from the site has been accomplished successfully (https://example.com/logout, for example):

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

Clearing cookies

If this header is delivered with the response at https://example.com/clear-cookies, all cookies on the same domain https://example.com and any subdomains (like https://stage.example.com, etc.), will be cleared out.

Clear-Site-Data: "cookies"

Specifications

{{Specifications}} 

Browser compatibility

{{Compat}} 

See also

In this article

View on MDN