Open getify opened 8 years ago
I assume you're just looking at having assets + code cached yes?
atm, that's what i'm thinking.
but tbh, there might very well be other kinds of offline-ability that would be interesting to discuss. for example, if the game eventually supports high-score boards or other kinds of tracking of your activity in a centralized account, and you're playing offline, maybe something like service-worker (or local-storage or whatever) could be keeping track of your activity and then sync it up when you go back online.
i'd like to have a broad discussion about strategies and options, since I don't really know what is even possible, entirely.
If you ware looking for something low risk and easy you may want to look at the auto.appcache
feature we provide with surge.sh. Surge.sh automatically generates an auto.appcache
file. All you have to do is link to it in your html tag like so <html manifest="/auto.appcache">
Works in pretty much every browser but like you say, it appears appcache is being EOLed.
Here is a blog post on the topic...
https://davidwalsh.name/dont-wait-serviceworker-adding-offline-support-oneline
I would go with service worker only. Appcache is it not worth the trouble in my opinion. Yes, this way it won't work offline in Safari and Edge at the moment but I am sure they will add support sooner or later and I think the more sites/apps use service worker the faster they will implement it :-)
I made a service worker for the game. Code Demo
And as you mentioned high-score boards, there you could use Background Sync
Happy to make a pull request for this.
Hard to argue with @justmarkup on this, unless iOS support is a requirement.
appcache is widespread but dying. serviceworker is on the rise.
should we use both? neither? etc?