I figured out how to export games in HTML format, but as many here know, they won't run on browsers Chrome or Firefox. I have a website that I am running from Google drive and would like to embed my game in that website, but because of the chromium based limitations they fail to load. Is there some kind of work around to make my game work on my webpage without having to use some obscure browser that no one uses?
Embedding a game on my website
More of a workaround than a solution, but: If you upload your game on Itch.IO, you can then embed it using a normal HTML iframe.
Once you have uploaded your HTML5 game, just go to the game's page, then distribute->embed game
, and it will show you to HTML you can paste into your website for hosting.
Thanks for that info, TwistedTwigleg! I had come across a YouTube video that suggested using Itch.IO, but wasn't sure if that would be the best way to go. The fact that you mentioned the same exact site for this leads me to believe this is a common practice. I'll give this method a try until a solution to this problem comes out.
What is the problem with the normal html export? I though one can just upload the files on a webserver and link people there?
ksjogo, I was trying to embed it directly on my website without going through a server like itch.IO.
- Edited
I would recommend using GitHub Pages instead of Google Drive to host a website. It's actually intended for the purpose of hosting websites :)
HTML5 exports can definitely be hosted on GitHub Pages.
Calinou, Thanks for the tip. I'll look into that!
I had a lot of difficulty figuring this out so I made my own tutorial if anybody is lost
Hope it helps
[]
Godot HTML5 works on all browsers, but you might need to adjust the server settings depending on what features you use (required on Godot 4.0). You also cannot test locally, it needs to be running from a server, not just the files.
cybereality You also cannot test locally, it needs to be running from a server, not just the files.
Well, a localhost server instance could be used, but takes extra effort to setup.
Megalomaniak Well, a localhost server instance could be used, but takes extra effort to setup.
Godot 4 (at least the last beta, I'm travelling and haven't tested the RC1) doesn't provide a local server, and cannot be run with test stuff like the Python HTTPServer, since you need to alter server parameters. You can still run locally, but you need extra configuration and it's not obvious to a new user.
- Edited
try:
from http import server # Python 3
except ImportError:
import SimpleHTTPServer as server # Python 2
class MyHTTPRequestHandler(server.SimpleHTTPRequestHandler):
def end_headers(self):
self.send_my_headers()
server.SimpleHTTPRequestHandler.end_headers(self)
def send_my_headers(self):
self.send_header("Access-Control-Allow-Origin", "*")
self.send_header("Cross-Origin-Embedder-Policy", "require-corp")
self.send_header("Cross-Origin-Opener-Policy", "same-origin")
if __name__ == '__main__':
server.test(HandlerClass=MyHTTPRequestHandler)
This worked for local testing with Python HTTPServer for me.
You can actually test with Godot HTML5 from the editor. The button is on the top right under Remote Debugging. Kind of a strange place to put it, but it works.