I recently exported a game in HTML zip file format to itch.io. Thing is, after I got it all set up and previewed it, it worked just fine the first time. But when I reloaded the page and tried playing it again I keep getting "WebGL context lost, try reloading the page" (in Chrome browser) or on Firefox I get "Indirect call to null. " Now I did set up a system for the game to save the player's high score on their device via singleton. Could that be causing my problem? Because I wasn't sure if running an HTML version in a browser would let me do that. That's just a theory I have, but could it be something else? But the fact that it worked the first time and then never again after is what has me scratching my head!
WebGL context lost in HTML game uploaded to itch.io!
My guess is that something with the saving or loading system is causing the issue, probably the loading code. That would explain why it worked fine the first time, but not the second, as it was trying to load the file and then crashed. I would see if commenting out that code fixes the issue. If that fixes the issue, then I would try debugging the save/load code on desktop and see if you get any errors.
- Edited
TwistedTwigleg, thanks for answering my question. Turns out it was just a graphics/cpu problem. When I switched from gles3 to gles2 it loaded, albeit a bit slowly. Then when I converted my music files to .ogg format and deleted a lot of unused files and assets from my directories it loaded and ran much more smoothly. And the save and load system works just fine. I wasn't sure if it would since I wasn't sure if a browser version of the game could save the player's files. Turns out it does in the form of cookies, unlike the executable version which saves it in app data on the user's device. This is my first official game I've put out there. Here's a link to play it if you're interested. I'm not trying to make money on this one and all the assets are my own....... https://itch.io/embed-upload/2538393?color=333333