No registra un service worker que controla la página y el start_url

Published on Updated on

Translated to: English, Português, 한국어, 中文, Pусский, 日本語

El registro de un service worker es el primer paso para habilitar las funciones clave de la aplicación web progresiva (PWA):

  • Funcionar sin conexión
  • Admitir notificaciones emergentes
  • Se puede instalar en el dispositivo

Obtenga más información en la publicación Service Workers y API de almacenamiento en caché.

Compatibilidad del navegador

Todos los navegadores principales, excepto Internet Explorer, son compatibles con los service workers. Consulte Compatibilidad del navegador.

Cómo fallar la auditoría del service worker de Lighthouse

Lighthouse marca las páginas que no registran un service worker:

Auditoría de Lighthouse que muestra que el sitio no registra un service worker

Lighthouse comprueba si el Protocolo de depuración remota de Chrome devuelve una versión del service worker. Si no es así, la auditoría falla.

In the Lighthouse report UI the full PWA badge is given when you pass all of the audits in all of the PWA subcategories (Fast and reliable, Installable, and PWA optimized).

Cómo registrar un service worker

Éxito

Workbox is the recommended approach for adding service workers to websites because it automates a lot of boilerplate, makes it easier to follow best practices, and prevents subtle bugs that are common when using the low-level ServiceWorker API directly.

El registro de un trabajador del servicio implica solo unas pocas líneas de código, pero la única razón por la que usaría un service worker es para hacer posible la implementación de una de las características de la PWA descritas anteriormente. La implementación real de esas características requiere más trabajo:

Recursos

Updated on Improve article

This site uses cookies to deliver and enhance the quality of its services and to analyze traffic. If you agree, cookies are also used to serve advertising and to personalize the content and advertisements that you see. Learn more about our use of cookies.