MY directories are as follows.
public_html/
sw/
The "sw/" is where I want to put all service workers, but then have those service workers with a scope to all the files in "public_html/".
JS
<script>
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('sw/notifications.js', { scope: '../sw/' }).then(function(reg) {
// registration worked
console.log('Registration succeeded. Scope is ' + reg.scope);
}).catch(function(error) {
// registration failed
console.log('Registration failed with ' + error);
});
};
</script>
How do I allow this sort of scope?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…