Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

BB_Dev

13
Posts
4
Topics
35
Followers
6
Following
A member registered May 10, 2015 · View creator page →

Creator of

Recent community posts

Ah nice, any idea if that works for iOS/iFrames?

(1 edit)

After a bit more research I have an answer. Basically, on itch and iOS, you cannot save to the browser and have it extend beyond the current session. The iframe and the page itself are two different domains, so its a CORS problem. The solution would be a server that users make an account/sign into, which is not ideal for quicker/more arcadey titles. For websites other than itch, there is hope for webgl games saving on iOS. If you own the page itself as well as the webgl, you can communicate from the iframe to the page to post data, this method uses window.postMessage which you can read up on here: https://www.teamsimmer.com/2023/05/02/how-do-i-use-the-postmessage-method-with-c...

So other than itch decided to give us access to our pages JS, we're out of luck. I also considered using cookies but we're limited to 4096ish bytes and I don't even know if we can do that from the iframe. Honestly I saw that the size was that small and figured it wasn't worth it.

I guess the best solution would be to throw your game up on a little site so you can handle saving to browser, then include a link to that page on the itch and hope mobile players find it? Or make a real iOS build and put it on the appstore. Neither solution works well for quicker/shorter titles.

Just before posting I found this post (https://itch.io/t/635029/enable-a-way-for-browser-games-to-access-the-username-o...) where someone asked Leafo the founder of itch if he would consider adding support for window.postMessage, it looks like a no but he was open to extending the current JS API. Maybe with our powers combined we can summon him here and get a mobile specific JS way to read/write to indexedDB/localStorage.

(2 edits)

As far as I can tell, indexedDB as well as localStorage are not supported on safari and by extension mobile. I believe Safari in general will only keep a file stored on the browser I think for up to a week. In regards to mobile, there are more problems. While you can make WebGL run smoothly on mobile, when it comes to saving at least on iOS, other browsers are actually built on top of Safari so they have the same saving issue. From what I can tell the browser will keep the file where you store it as long as you don't close out the entire app. You can close/switch tabs, but once you actually close the browser app you lose the data. 

This has been a big headache for my project, I'm using version 2022.1.23f1 if you care to compare. I actually don't own a mac and thus cannot inspect the page on iOS, but I have a crappy little mac mini showing up this Monday 10/9/23 so hopefully I can get to the bottom of this.

That's what it does already? Not sure what you mean by this.

It's "mobile friendly" not "mobile bffs"

PetAI community · Created a new topic Bug Reports

Please report any and all bugs in here. Thanks

Thanks for playing! I see it bugged out a bit at the end there, I'll fix it soon