Hmtl error 410 plus other problems with html app on itch running on iOS Safari (closed)

My html app on itch refuses to run on iOS Safari with this error:

failed to load resource the server responded with a status of 410 (gone)

An error indicating that the resource requested by the client has been permanently removed. Which is strange, since it runs just fine on every other OS.

This happens whenever I have textures on my models, either set in the editor or loaded dynamically.
The splash finishes, the game starts to load, stops and reloads for a few times - then the Html error 410 occurs.
When I remove all textures, the app does load, but renders upside-down, the perspective is warped and the full screen button on itch does not work either.

In addition, I get three identical errors when the Defold splash is running:

[Error] FS syncfs error: SecurityError: IDBFactory.open() called in an invalid security context
	(anonymous function) (dmloader.js:723)
	doCallback (Script Element 1:1:44755)
	done (Script Element 1:1:44853)
	(anonymous function) (Script Element 1:1:33512)
	(anonymous function) (Script Element 1:1:35060)
	getDB (Script Element 1:1:33788)
	getRemoteSet (Script Element 1:1:35003)
	(anonymous function) (Script Element 1:1:33462)
	getLocalSet (Script Element 1:1:34900)
	syncfs (Script Element 1:1:33389)
	(anonymous function) (Script Element 1:1:45008)
	forEach
	syncfs (Script Element 1:1:44933)
	preSync (dmloader.js:720)
	(anonymous function) (dmloader.js:782)
	Global Code (Script Element 1:1:263809)
	appendChild
	(anonymous function) (dmloader.js:190)
	onload (dmloader.js:91)
	onload (dmloader.js:36)

Does anyone know what might be going on? I am quite clueless what to do next.

Ok, this sounds like it could be a problem. Are you loading them as custom resources?

1 Like

Hello @britzl,

thank you very much for your reply. Yes, I do have custom resources.
If it comes to the loading, I tried two versions:
one, where I dynamically load the model textures from the custom resources, one, where I set the model textures in the editor. In both cases, there are custom resources, because I need them for the slideshow.

Ah, yes, the app on itch runs in an iframe and there’s probably some security features preventing the content in the iframe from loading and saving stuff on “disk” (or in the case of HTML5 in the IndexDB for the page).

There’s a bunch of similar issues on Google:

https://www.google.com/search?q=SecurityError%3A+IDBFactory.open()+called+in+an+invalid+security+context

BUT that doesn’t really explain why you can’t load textures from the game archive… How are you loading the textures? Using sys.load_resource()?

EDIT Well, yes, I guess that is the only way if the textures are bundles as custom resources…

1 Like

Yes, I’ve googled them, too, I don’t think, this has to do with the loading issue, though :thinking:

Yes, I use sys.load_resource :slightly_smiling_face: - for the gui slideshow, to flip through the images. In the version where I dynamically load the model textures, I use @sergey.lerg 's image loader. So, I first thought, it might have to do with image loader. But the app doesn’t run either when I remove it and use the “standard” version, setting the model textures in the editor.

I decided to not let go and ran some tests.
My test device: iphone 6s running iOS 15.7, my desktops: mac mini m1, Monterey 12.6 , Windows 10, and Manjaro Linux 21.3.0. I tested with Defold 1.3.5 and 1.3.6
I took several of my 3d projects plus additional 3d projects: “Driller” by @aglitchman, Kinematic Walker by @astrochili and Defold’s basic 3d template. I bundled them and uploaded them to itch.
This is the outcome - on the left running in a desktop browser, on the right the canvas in Safari’s developer console on the iphone:

As you can see: the 3d models (not the guis) are rotated, the camera view totally off.
All the projects produced the 3 identical errors when running the splash I mentioned above.
Next, I looked for some other 3d projects made with Defold on itch, kinematic walker one of them - same thing, models are rotated, camera wrong, anything gui renders just fine.

So, I conclude:
this has nothing to do with my custom resources, nor with @sergey.lerg 's image loader, nor with dynamically loading textures. Now, I would like to find out if the problem lies with itch, with Safari, with iOS, with Defold or with my phone.

May I please ask folks with an iphone to check if this happens on your devices, too?
I left my demo project (the first one in the image) on itch for you to have a look:
(link removed)
As to the html 410 error, it occurs when I try to load more than roughly 80 textures. Don’t know what to do about this :neutral_face:

It would be a bit sad it my html project would not be available for iphones or ipads :cry:

Edit:
just to add: I have no problems with any 2d project and the 3d projects run well on my Android, Windows and Linux devices, on the mac mini, too.

1 Like

Since I cannot solve the issues on my own, I have now settled for a solution that circumvents them. There will be no 3d virtual museum for mobiles on itch, they will be catered for by a 2d version.
I have removed the link to my demo and the thread can be closed now.

We’re discussing this issue, and yeah, it is Safari, and Safari is everything but great. Still, it is a very strange problem.

On thing you can do is to give a 2D version of the game to users running Safari. All other users could get the 3D version. You can detect which browser the user has:

local user_agent = sys.get_sys_info().user_agent

-- or

local user_agent = html5.run("navigator.userAgent;")
1 Like

Ah, that is a possibility. Thank you, Björn. Will give it a try - although, I am unhappy with my mobile controls as they are anyway. It might be a more pleasant experience on very small screens to have a nice and polished 2d version, with very easy navigation and pretty reflections, too. I can’t see older folks and non-gamers juggling with a joystick or a split screen even though I reduced the speeds quite a bit.
But the 3d stuff is really strange, that is true.

Hmmm. I tested on iOs 15.6 then updated to iOS 15.7 and it works fine for me

Did you touch any Safari experimental functions on your iPhone? If so, could you pls try to reset all the advanced experimental features to default?

3 Likes

Oh, this is interesting, thank you for trying this out for me!

It is my husband’s work phone, I need to wait for a moment where I can have it for a bit. He certainly didn’t touch anything experimental, and I just enabled debugging, hooked up the phone with the mini and checked the console. Will try once more when I have access to the phone. Might it be as simple as the age of the phone?

2 Likes

I tested on my iPhone Xs, so it’s possible, yes, but I’m not sure.

2 Likes

Thank you - as soon as I can have another go with the phone, I’ll check the settings once more, give it another go and report back.

Not sure I’m helping, but if you use the Developer settings in Safari, you can mimic an iOS device by setting the user agent (either predefined, or a custom one)
Try to figure out what user agent the phone would have.

1 Like

Aha, great - thank you!

@Mathias_Westerdahl - Mathias, I have tried now with quite a few user agents and they all run the app fine. I suspect, there is sth going on with the phone. :thinking: Thank you for pointing me to the mimicking possibility!

You can also use Safari to debug the iOS Safari when the phone is connected to your computer. It was a while ago though, but if you get that working, you can more easily checkout the logs etc.

1 Like

So, what I did is: enabled debugging on the phone, hooked it up via usb and then debugged and checked the logs in Safari on the mini - is this what you mean?

yes, that sounds about right

1 Like

Hm, the images of the canvas above are the output of this debugging procedure and reflect what is happening on the phone. But since apps runs ok on other phones and also when using the mimicking, I strongly assume that there is sth going on with the phone itself.