Jump to content

CORS error referencing JavaScript files

Recommended Posts

Using this method to upload a Javascript file

But then, when I try to reference it from the Squarespace site, I get a CORS error:

Access to script at 'https://static1.squarespace.com/static/57014b5b746fb963478e3d4f/t/5d7ba83d4e25b616833d896b/1568385085375/runtime-es2015.js' (redirected from 'https://brooke-meek.squarespace.com/s/runtime-es2015.js') from origin 'https://brooke-meek.squarespace.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Am I doing something wrong here?

Edited by popsovy
Initial Revision
Link to comment
  • 3 months later...
  • 5 months later...
  • 1 month later...
  • 3 weeks later...

That's presumably what @popsovy was already doing, as it's the method used in the page he linked to. Unfortunately that doesn't work, as /s/filename.ext is loaded from static1.squarespace.com, for which Squarespace unhelpfully don't have a CORS Access-Control-Allow-Origin header.

Link to comment
  • 1 year later...

Hi @popsovy - did you resolve this? 

Ccing you as well @MattB2

I am trying to use d3.csv to access a file I have uploaded as a link and whatever I get a 404 with the filename and a CORS with /s/ + filename or the full https static1.squarespace link...  Confused!

Edited by MilesB
Link to comment
  • 1 year later...
On 8/25/2020 at 8:49 PM, salondaome said:

How does one get/find the static1.squarespace.com URL @MattB2? Whenever I put in the domain.com/s/script.js URL into my browser, for example, it just automatically downloads the script file. Doesn't actually show where the redirect URL is.

In the "Custom CSS" area, there's a control to allow uploading "Custom Files" (font files). When uploaded this way, the CORS headers are set correctly, automatically. Clicking on an uploaded file automatically inserts the file's path in your custom css, but you need to check where the path is inserted. 

Edited by tedfitzpatrick
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

  • 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.