Access-Control-Allow-Origin errors

Shopify Partner
22 0 1

This is a strange one, I am using the Google Maps API on  one of my static pages, to show a list of retail stores on a Google Map.

This was working fine, as I was focussing on developing the rest of the theme.

To be clear, this code has been untouched for ages, and had been working just fine only yesterday. I take timely backups so I went back a few versions to when I was sure that it worked, and the problem still persists.

This is the error I am getting in my Javascript console, I replaced the store id's with x

XMLHttpRequest cannot load https://cdn.shopify.com/s/files/1/x/x/t/13/assets/infowindow-description.html?4173. Origin https://x.myshopify.com is not allowed by Access-Control-Allow-Origin. retailers:1

XMLHttpRequest cannot load https://cdn.shopify.com/s/files/1/x/x/t/13/assets/location-list-description.html?4173. Origin https://x.myshopify.com is not allowed by Access-Control-Allow-Origin.

 

What could be causing this? The only change is that I have loaded my theme onto a client's Shopify Account and continued final development there.. yet when I check on my development shop, where it definitely worked, it has the same error.

Another thing I noticed was that my clients' shop is using https://, whilst my development shop is using http://, this was causing security errors which I fixed by switching those scripts to https://

 

Any ideas or tips would be very grateful, I did not expect something like this to become such a huge obstacle for my project!

 

0 Likes
Shopify Partner
22 0 1

I've had an interesting development which might be related to what is causing this.

 

When working in Textmate, I noticed that the file referenced by my page was listed twice in my Assets folder.

jquery.retailers.js.liquid

jquery.retailers.js

I haven't noticed this with other assets that I labeled with .js.liquid, so I am unsure if this a bug or normal behaviour.

I tried changing the name of the .js file and reloaded the theme to make sure it wasn't cache related, but the file was once again duplicated and downloaded by Textmate.

I can't find the file listed in the Assets folder in the Template Editor, so perhaps it is just Textmate making a mistake? Still, it seems odd that it happens to the .js file that is associated to the problematic page that wont load.

 

Hopefully this helps identify the problem..!

0 Likes