Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Resolved: CORS error when trying to run Unity WebGL game on itch.io?

A topic by Midnite Oil Software LLC created Jul 26, 2020 Views: 2,842 Replies: 3
Viewing posts 1 to 3
(2 edits)

Greetings, I have published a draft of a Unity 3D WebGL game to itch.io but when I try to run it I get the error "Access to XMLHttpRequest at 'https://googleads.g.doubleclick.net/pagead/id' from origin 'https://www.youtube.com' has been blocked by CORS policy. It looks like it's trying to call into google ads (I did not add ad support so far as I know) and is blocked by CORS. 

Further down it says "Uncaught ReferenceError: unityFramework is not defined at HTMLScriptElement.n.onload.

I assume there's some configuration change I need to make to get this work. Can someone point me in the right direction?

Thanks!


(+1)

Disabling compression in the Publishing settings fixed this. 

Admin (1 edit) (+1)

I don’t think this has anything to do with us. It looks like you have a youtube embed in your project that might be causing it. I think the error about youtube and google ads is ignorable, and the real error is listed immediately below that with “Invalid or unexpected token”

(+1)

Yes, it was the GZIP compression that was causing the error. As for the youtube/googleads embedding, I'm guessing Unity is including them somehow by default when I build the project. I'll need to research that. 

This topic has been auto-archived and can no longer be posted in because there haven't been any posts in a while.