Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

88
Views
Service Worker no representa la página offline.html que he creado

Mi trabajador de servicio no muestra la página offline.html que he creado. Solo muestra la página web real antes de borrar el caché. Después de borrar el caché, muestra la página habitual de pérdida de conexión en modo sin conexión en lugar de mostrar la página offline.html que he creado. Lo he dado de baja una vez. Esa es la razón de ello. Adjunto la captura de pantalla del archivo serviceworker.js aquí: serviceworker.js . Es una aplicación de reacción que convertí a PWA.

Aquí está mi serviceworker.js:

 const CACHE_NAME = "version-1"; const urlsToCache = ["index.html", "offline.html"]; const self = this; //installing SW self.addEventListener("install", event => { event.waitUntil( caches.open(CACHE_NAME) .then(cache => { console.log("Opened Cache") return cache.addAll(urlsToCache) }) ) }) //fetching request self.addEventListener("fetch", event => { event.respondWith( caches.match(event.request) .then(() => { return fetch(event.request) .catch(() => caches.match("offline.html")) }) ) }) //activating SW self.addEventListener("activate", event => { const cacheWhiteList = []; cacheWhiteList.push(CACHE_NAME) event.waitUntil( caches.keys() .then(cacheNames => Promise.all( cacheNames.map(cacheName => { if (!-cacheWhiteList.includes(cacheName)) { return caches.delete(cacheName) } }) )) ) })

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!