question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

serviceWorker API not available?

See original GitHub issue

Bug description: navigator.serviceWorker API unavailable within webview. User agent reported by the webview: Mozilla/5.0 (Linux; Android 9; ONEPLUS A3010 Build/PQ2A.190305.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/72.0.3626.121 Mobile Safari/537.36

To Reproduce:

<WebView
        source={{ html: `<script>alert(navigator.serviceWorker)</script>` }}
      />

Expected behavior: navigator.serviceWorker API should be available from Android Webview 40?

Environment:

  • OS: Android
  • OS version: 9
  • react-native version: 0.59.9
  • react-native-webview version: 5.12.0

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
magbicalemancommented, Sep 16, 2019

@mhingston did you end up resolving this somehow, or choosing another platform?

1reaction
wentokaycommented, Jul 30, 2022

navigator.serviceWorker won’t be available via inline HTML

it can only be used on a webpage that’s loaded over SSL, i.e.

<WebView source={{ uri: "https://somewherehostingtheserviceworker.com" }} />
Read more comments on GitHub >

github_iconTop Results From Across the Web

Service Worker API - MDN Web Docs
Service workers essentially act as proxy servers that sit between web applications, the browser, and the network (when available).
Read more >
serviceWorker API not available? · Issue #645 · react-native ...
Expected behavior: navigator.serviceWorker API should be available from Android Webview 40? Environment: OS: Android; OS version: 9; react- ...
Read more >
Why is Service worker not working in Chrome? - Stack Overflow
I am trying to make a PWA and am currently testing to see if my manifest and service worker are working. In my...
Read more >
Service workers - web.dev
The Service Worker API is even available on platforms that do not support PWA installation, such as Safari and Firefox on desktop devices....
Read more >
Angular service worker introduction
Service workers augment the traditional web deployment model and empower applications to deliver a user experience with the reliability and performance on ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found