popsovy Posted September 13, 2019 Posted September 13, 2019 (edited) 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 September 13, 2019 by popsovy Initial Revision
tantrum Posted January 9, 2020 Posted January 9, 2020 Hi. I'm having this exact same issue-- both with Javascript files and trying to refer to a json file. Were you able to find a solution?
tantrum Posted January 15, 2020 Posted January 15, 2020 I found a way to deal with it-- I put .js and .json files in a s3 bucket and turned out a CORS policy on the s3 bucket.
Alan-Squareflair Posted June 25, 2020 Posted June 25, 2020 There's a fix that @dmitrykiselyov has used a few times as a way to give the browser what it needs.I'll let him share it here if he chooses to. (He can also explain it better than me!)
dmytrokyselov Posted August 4, 2020 Posted August 4, 2020 Hi @popsovy, Try this path /s/runtime-es2015.js <script src="/s/runtime-es2015.js"></script> tuanphan 1
Guest Posted August 22, 2020 Posted August 22, 2020 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.
Guest Posted August 22, 2020 Posted August 22, 2020 Okay, so the correct answer seems to be to use the redirect URL (e.g. https://static1.squarespace.com/static/57014b5b746fb963478e3d4f/t/5d7ba83d4e25b616833d896b/1568385085375/runtime-es2015.js in @popsovy's case), not the path that @dmitrykiselyov mentioned.
salondaome Posted August 26, 2020 Posted August 26, 2020 (edited) 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. Edited August 26, 2020 by salondaome
MilesB Posted June 23, 2022 Posted June 23, 2022 (edited) 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 June 23, 2022 by MilesB
tedfitzpatrick Posted December 5, 2023 Posted December 5, 2023 (edited) 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 December 5, 2023 by tedfitzpatrick Correction
ThomasDes Posted August 7 Posted August 7 Hello. I realize this is an old thread, but I couldn't find a solution elsewhere. I'm trying to upload audio files and use them in custom code. It's impossible to upload them to Custom CSS and any other method gives me the CORS error. Using "https://static1.squarespace.com" etc. isn't working either. Thank you!
paul2009 Posted August 7 Posted August 7 26 minutes ago, ThomasDes said: I'm trying to upload audio files and use them in custom code. I've replied to your other post here. Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥. Work: Founder of SF.DIGITAL. We provide high quality original extensions to supercharge your Squarespace website. Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links. Forum advice is completely free. You can thank me by selecting a feedback emoji. Buying a coffee is generous but optional.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment