Frontend developer Max Böck some time ago posted an article on how to create offline-friendly web forms
Using the navigator.onLine
method for checking if the user is still connected to the Internet, localStorage
and service workers Max outlines a method for alleviating an annoying problem that comes with using forms on the web, particular on mobile platforms:
Losing data and having to fill in a form repetitively if you lose your Internet connection before that form has been submitted.
Having forms retain data in offline situations hence provides tremendous usability benefits.