Jump to content

PWA on squarespace

Recommended Posts

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,

  1. 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."
  2. 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
  • Replies 1
  • Views 1.4k
  • Created
  • Last Reply
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,

  1. 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."
  2. 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 picker form field)
💫 Gallery block 7.1 workaround
🥳 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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.