You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12 lines
658 B
JavaScript

// Register the pass-through service worker (see /sw.js) so ngrok's free-tier browser
// interstitial is skipped on revisits / PWA launches. Registering /sw.js also UPDATES
// (and thereby replaces) any previously-installed caching service worker, whose
// activate handler then clears the old caches.
//
// Caveat: the very first visit on a new browser still shows the ngrok page once — a
// service worker cannot exist before that initial load. ngrok's own cookie suppresses
// it after one "Visit Site" click; the SW then keeps it gone across sessions.
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/sw.js').catch(() => {});
}