I had this idea for an app to handle registration and results for kayak races. I had the following requirements in mind:
- It must work when off-line
- It must work on laptops and tablets
- Preferably, it will sync up with a server when it is on-line
- It must not require any installation or other technical futzing around because my target audience (the people who run kayak races) are not all very technically sophisticated.
After that, my idea was to make a proof of concept, and incrementally improve it as I got more ideas and maybe got some interest from others. I also wanted it to be a web page (with supporting JavaScript and CSS files), one that I could just give people a zip file and they could unzip it and open index.html in their browser and be good to go.
I discovered PouchDB, which would take care of the storing information locally in the browser when off-line, and also would sync to a server when it came time to do that. And so off I went programming away. My little proof of concept was humming along, it could accept registrations and display and edit existing registrations, and I was well set to add results entry and display, when I thought to try it on the bane of every web developers lives, Internet Explorer.
First problem: IE reports the ‘fetch’ is not a valid function. Fortunately, the documentation for PouchDB warns you about that, and says to install a polyfill. So I install it, and now IE reports ‘Promise’ is not a valid function. Hmm, no mention of that in the PouchDB docs that I can find.
Can I just mention as an aside that the PouchDB docs do say that it supports IE 10 and IE 11? Yeah, about that…
Thanks to an answer on StackOverflow, I find another polyfill for Promise. Now IE reports that you can’t use IndexDB on web pages that are loaded as files rather than as URLs. Not sure what to do about that except tell people to stop using IE. It appears that with my polyfills and stuff, it does work in Edge, at least. Small mercies.