How to Load WebGL Games

I have been looking all over been to ocuntless threads from 2011 and 2018 and theyve all used outdated and obsolete ways, so i have unity build in wegbl of my game and im wondering how to i run it on a website so others can play, preferbly not using itch.io or simmer.io, im currently using wix or wordpress to try and host my website but im open to any service

1 Like

Hi @JoDoyle12 , not sure if I’m missing something, but if you just upload the content of your build folder to your server and open the index.html that Unity generates, you should be able to play the game from there.

If you want to include your game in some other specific page, you can copy the content from the Index.html to the page you want to use or modify that html file as you need.

If for example, you want to use a Wordpress site, I would probably create a php template, insert you html code there and create a page using that template.

2 Likes

This is interesting, but I don’t quite understand the documentation of your link.
Still, what should we do with the Build and TemplateData folders and the index.html file?
I have tried to upload it to the website and it always shows the same error:
Failed to download file Build/ParaSubirWordPress.data.gz. Loading web pages via a file:// URL without a web server is not supported by this browser. Please use a local development web server to host Unity content, or use the Unity Build and Run option.
Can you give any more ideas ?
Thank you

That error indicates you are trying to load files that are stored in your local file system. Browsers refuse to load files from the local file system via the file:// URL for security reasons. You need to set a URL that either points to the same domain where you host your Unity game at (via the same protocol http:// or https:// where you host the page), or to an external domain, but then you’ll have to configure your web server to enable CORS access to the web server domain where the Unity game runs at.

2 Likes

I have a question :

  • Would you tell me where I can find the correct documentation to configure a URL that points to the same domain where I will host my Game?
  • Where is the correct information to configure your web server to enable CORS access?
    I would be very grateful if you can provide me with a link to be able to carry out the steps that you tell me.
    I have searched in Google, but maybe I am not searching for the correct terms, but I do not find anything similar
    Thank you @unityruba