I want to implement a button to delete cookies, caches, etc. in JavaScript.

Asked 1 years ago, Updated 1 years ago, 26 views

https://developer.mozilla.org/ja/docs/Web/HTTP/Headers/Clear-Site-Data

Clear-Site-DataI'd like to place a button to delete the cache.
The header may be incorrectly specified, but it does not work.

How do I set it up?

javascript

2022-09-30 19:51

2 Answers

async fetch("/", headers{"Clear-Site-Data":"*"})I'd like to do it like this...

However, the header in is not a request header, but a response header, which is specified on the server side. Naturally, if you specify it in the request header, it will not work.

If you are using a server environment where you cannot dynamically specify headers, you may need to take other steps.


2022-09-30 19:51

This is a partial answer, but if you set the expiration date to a value older than the current time it will be deleted.


2022-09-30 19:51

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.