mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-05 05:25:49 +01:00
Adds a `Service-Worker-Allowed` header on `assets/src/service-worker.js` URL and uses `scope` option during registration to ensure the service worker is correctly scoped to the entire forum and only the forum.
This commit is contained in:
@@ -788,7 +788,7 @@ app.cacheBuster = null;
|
||||
|
||||
function registerServiceWorker() {
|
||||
if ('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker.register(config.relative_path + '/assets/src/service-worker.js')
|
||||
navigator.serviceWorker.register(config.relative_path + '/assets/src/service-worker.js', { scope: config.relative_path + '/' })
|
||||
.then(function () {
|
||||
console.info('ServiceWorker registration succeeded.');
|
||||
}).catch(function (err) {
|
||||
|
||||
Reference in New Issue
Block a user