Search code examples
corsweb-audio-apisquarespace

Getting Squarespace to add Access-control-allow-origin header


I'm trying to load some audio files into a squarespace page that will be run through Web Audio API and I get the following error: "MediaElementAudioSource outputs zeroes due to CORS access restrictions for..." I inspected the response header from the Squarespace site it does not have the Access-Control-Allow-Origin header. From what I understand, Web Audio API requires the header or else it outputs zeros. Is there a way to get Squarespace to add the header in the response or am going to be forced to find a different solution? I need to process the audio with the API so I can't use HTML's <audio> elements which would work.


Solution

  • Unfortunately, you won't be able to allow cross-origin requests to assets stored on a Squarespace site. The assets are served from Squarespace's global CDN (unspecific to your website) and, correspondingly, they don't provide access to change such restrictions.