The Clear-Site-Data
header clears browsing data (cookies, storage, cache) associated with the requesting website. It allows web developers to have more control over the data stored locally by a browser for their origins.
Header type | Response header |
---|---|
Forbidden header name | no |
The Clear-Site-Data
header accepts one or more directives. If all types of data should be cleared, the wildcard directive ("*"
) can be used.
// Single directive Clear-Site-Data: "cache" // Multiple directives (comma separated) Clear-Site-Data: "cache", "cookies" // Wild card Clear-Site-Data: "*"
"cache"
"cookies"
"storage"
localStorage.clear
),sessionStorage.clear
),IDBFactory.deleteDatabase
),ServiceWorkerRegistration.unregister
),NPP_ClearSiteData
)."executionContexts"
Location.reload
)."*"
(wildcard)If a user signs out of your website or service, you might want to remove locally stored data. You can achieve that by adding the Clear-Site-Data
header to the response of https://example.com/logout:
Clear-Site-Data: "cache", "cookies", "storage", "executionContexts"
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"
Specification | Status | Title |
---|---|---|
Clear Site Data | Working Draft | Initial definition. |
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | 61 | ? | 63
|
? | 48 | ? |
Mobile | |||||||
---|---|---|---|---|---|---|---|
Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
Basic support | 61 | 61 | ? | 63
|
48 | ? | ? |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Clear-Site-Data