Guest Posted April 22, 2021 Share Posted April 22, 2021 (edited) Hey I am just curious if anyone has gotten a progressive web app working with squarespace. I have tried a few ways to get a PWA working but to no avail. I just can't get the service worker to take the scope of my root directory. I have tried, Adding a URL redirect, /sw.js -> /assets/sw.js 301. The issue is that service workers aren't allowed to hide behind redirects, it throws the error "The script resource is behind a redirect, which is disallowed." Adding scope to the options parameter when registering the service worker. navigator.serviceWorker.register("/assets/sw.js", { scope:"../" }) This throws the error, "The path of the provided scope ('/') is not under the max scope allowed ('/assets/'). Adjust the scope, move the Service Worker script, or use the Service-Worker-Allowed HTTP header to allow the scope.". I can't adjust the scope or move the Service Worker script and I can't add HTTP headers to the response. I have scoured the internet for solutions to this issue but I can't find any information about PWAs with squarespace. Any information is helpful, thanks! Edited April 22, 2021 by Kaden-Sharpin Clarification. Link to comment
Beyondspace Posted April 22, 2021 Share Posted April 22, 2021 2 hours ago, Kaden-Sharpin said: Hey I am just curious if anyone has gotten a progressive web app working with squarespace. I have tried a few ways to get a PWA working but to no avail. I just can't get the service worker to take the scope of my root directory. I have tried, Adding a URL redirect, /sw.js -> /assets/sw.js 301. The issue is that service workers aren't allowed to hide behind redirects, it throws the error "The script resource is behind a redirect, which is disallowed." Adding scope to the options parameter when registering the service worker. navigator.serviceWorker.register("/assets/sw.js", { scope:"../" }) This throws the error, "The path of the provided scope ('/') is not under the max scope allowed ('/assets/'). Adjust the scope, move the Service Worker script, or use the Service-Worker-Allowed HTTP header to allow the scope.". I can't adjust the scope or move the Service Worker script and I can't add HTTP headers to the response. I have scoured the internet for solutions to this issue but I can't find any information about PWAs with squarespace. Any information is helpful, thanks! I think you should consider wix for this purpose, it is built as single page application in the first place BeyondSpace - Squarespace Website Developer 🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox) 🗓️ Delivery Date Picker (Squarespace Date format) 💫 Animated Buttons (Referral URL) 🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations) 🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates) If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you! Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment