Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

292
Visualizações
Service worker runs in browser (chrome) but fails to register in Android WebView?

So currently, i'm working with an app that is written in react and has a service worker script. It is rendered on a Honeywell CT40 device via an Android hardware abstraction layer through a webview in the android/java code. Everything seems to work fine in the chrome browser when running the react app only. However, when the android app runs and renders the app, the service worker fails to register. The only error message I get on the chrome logs are:

Uncaught DOMException: Failed to execute 'importScripts' on 'WorkerGlobalScope': The script at 'https://storage.googleapis.com/workbox-cdn/releases/5.1.2/workbox-sw.js' failed to load.

This error only occurs when visiting the app through the android app via webview, but when using the browser directly, no issues.

Any thoughts?

WebView version: 79.0.3945.116

WebView version: com.android.chrome

Again, this works as expected in the browser itself, just not in the android webview browser it seems. Any idea? Attached are screenshots. Below is a code sample of where the service worker script starts. As stated in the documentation here: https://developer.chrome.com/docs/workbox/modules/workbox-sw/

    /* eslint-disable */

    importScripts(
      'https://storage.googleapis.com/workbox- 
   cdn/releases/5.1.2/workbox-sw.js'
);

let window = self
importScripts('/__ENV_FILE__.js')
workbox.setConfig({
  debug: window.$$.APP_WORKBOX_CONFIG_DEBUG || false
})

const { precacheAndRoute, createHandlerBoundToURL } = workbox.precaching
const { NavigationRoute, registerRoute } = workbox.routing
const { NetworkOnly } = workbox.strategies
const { Queue } = workbox.backgroundSync

// Injection point of precache assets
precacheAndRoute(self.__WB_MANIFEST)

self.addEventListener('message', (event) => {
  if (event.data && event.data.type === 'SKIP_WAITING') {
    self.skipWaiting()
  }
})

error 1

error 2

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda