registerProtocolHandler Demo

This page uses navigator.registerProtocolHandler(scheme, url) to register this site as a handler for a custom protocol. After registering, the browser will usually prompt you to allow it. Once allowed, clicking a link with that scheme opens the handler URL with %s replaced by the full, percent-encoded link target.

1. Register a handler

Custom schemes must start with web+ (or be a browser safelisted scheme). The handler URL must be same-origin and contain a single %s placeholder.

Scheme: web+playground
Handler URL:

2. Test it

Once the handler is allowed, click a link below. The browser should route it back to this site's handler page and show the payload.

web+playground:hello-world web+playground://open?id=42&name=demo web+playground:special chars & spaces

How it works

  1. Click Register handler and accept the browser prompt.
  2. Click one of the test links. The browser rewrites the click into a navigation to with %s replaced by the URL-encoded link.
  3. The handler page (./handle/) reads the encoded target from the query string and displays it.

To remove the registration, use the browser's site settings (Chrome: chrome://settings/handlers, Firefox: Settings → Applications). The unregister button opens that page where supported.