Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add warning when trying to load HTML5 build from local filesystem #7463

Merged

Conversation

britzl
Copy link
Contributor

@britzl britzl commented Mar 13, 2023

A common mistake for beginners is to double-click on index.html when attempting to test an HTML5 bundle. This will not work since the browser is unable to load the rest of the files required to run the Defold game. This change adds a warning message and instructions on how to test an HTML5 build locally:

Screenshot 2023-03-13 at 15 47 05

Fixes #7447

@@ -69,6 +69,11 @@
</head>

<body>
<div id="running-from-file-warning" style="display: none; margin: 3em;">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we exclude it for release?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly. Or have it as an option in game.project?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm maybe, but in this case user will never know we have something like this in index.html

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One concern I have with removing this warning in a release build is that a beginner might export a release build and try to double-click on index.html and end up in the same situation as we're trying to resolve.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true

@britzl britzl merged commit 5d06f1c into dev Mar 14, 2023
@britzl britzl deleted the Issue-7447-warn-when-running-html5-from-local-filesystem branch March 14, 2023 10:19
@subsoap
Copy link
Contributor

subsoap commented Mar 16, 2023

If you bundle Defold HTML5 projects into a single HTML file it does work though!

You can try it yourself with this tool

https://github.com/aglitchman/defold-playable-ads

I wish this was a feature of Defold when bundling HTML5 projects as a checkbox since there are many use cases for this beyond ads. Simply making sharable single file games or apps that do work when ran locally is useful too.

@subsoap
Copy link
Contributor

subsoap commented Mar 16, 2023

So point is maybe don't force this warning always / add easy way to disable it.

@britzl
Copy link
Contributor Author

britzl commented Mar 16, 2023

So point is maybe don't force this warning always / add easy way to disable it.

The warning is added to the default index.html. If you bundle your game into a single html file you won't be using the default index.html anyway.

Jhonnyg pushed a commit that referenced this pull request Apr 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improvement to make it clear that html5 bundle should be run using a web server
3 participants