Guest Posted April 22, 2021 Share Posted April 22, 2021 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! 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, video lightbox and much more) 🗓️ Delivery Date Picker (Squarespace Date picker form field) 💫 Gallery block 7.1 workaround 🥳 No-code customisations for Squarespace (+100 Spark plugin customisations) 🥳 Freemium Squarespace Widget Templates (+1000 Elfsight 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
Archived
This topic is now archived and is closed to further replies.