::clear Experimental

The ::clear suffix clears this site's data in the visitor's browser, with the Clear-Site-Data header, and then returns to the page. By default it clears everything.

Note: The ::clear suffix is experimental and may change.

Syntax

plain
https://name.rt.ht/::clear
https://name.rt.ht/docs/::clear?%22cache%22,%22storage%22
https://name.rt.ht/::clear?keep-%22cache%22

The path ends in ::clear. It works on any URL of any host the platform serves.

Parameters

Directives

The directives are the URL-decoded query without its leading ?, or "*" when the query is empty. Write each directive as a quoted string, comma-separated and URL-encoded: %22cache%22,%22storage%22.

Directives such as "cache", "cookies", "storage", "executionContexts" and "*" are values of the Clear-Site-Data header.

keep-

A query that starts with ?keep- uses the decoded rest after ?keep- as the directives, "*" when it is empty, and suppresses the redirect. The page stays open and shows the confirmation.

Response

StatusContent-TypeHeadersBody
200text/html;charset=utf-8Clear-Site-Data: <directives>A small page that shows Site data (<directives>) cleared!.

Without keep-, the page redirects with a meta refresh to the path only. The query, which carried the directives, is not restored: /docs/::clear returns to /docs/, /docs::clear to /docs and /::clear to /. The page also calls close(). That closes the window only where the browser lets script close it, such as a popup opened by script or a new tab with a single history entry, for example one opened with target=_blank. In a tab with earlier history, and in an iframe, it does nothing.

The browser clears the selected data for the origin of the response. "*" and "cookies" also remove the sign-in cookies of that host, so the visitor is signed out of it. Per the Clear-Site-Data specification, "cookies" covers the registrable domain. rt.ht is on the Public Suffix List, so on rt.ht only name.rt.ht is affected. On a custom domain such as app.example.com, it also clears the cookies of example.com.

Access

Anyone can use it, on any URL, without signing in.

Examples

html
<a href=::clear>Reset this site</a>
<a href=::clear?keep-%22cache%22>Clear cached files only</a>

The first link clears everything with "*" and returns to the current directory. Clearing also signs the visitor out of this host. The second link clears only the cache and stays on the confirmation page. Both links navigate the current tab on purpose: a tab opened with target=_blank has a single history entry, so the page's close() may close it at once.

Specifications

Not part of any specification. ::clear is an RTEdge.net feature. It sends a header from:

Specification
Clear Site Data
The Clear-Site-Data header (MDN)

Availability

FeaturePlaygroundRTEdge.netNotes
::clear ExperimentalPartialYesThe playground command Clear: Service Worker (Ctrl+Shift+W / ⌘+Shift+W) clears the worker import cache and then loads the ::clear page of the output origin. The load wipes the output origin's storage and service worker, and the playground shows "Cleared service worker".

See also