I am building a progressive web app which I want to function in offline mode also. This means I am caching all the JavaScript, CSS, fonts, etc. with a service worker (workbox) and keep in localStorage whatever I need for the app so that it doesn't crash. For example if the user wants to send a message/upload image when he does not have an active Internet connection, I am storing that in localStorage so that he can just resend it when Internet connection is back online, without having to upload it again.
The current functionality is when the device has no Internet connection I am saving the uploaded file in the localStorage, so that when you are back online you don't have to upload it again, you just hit a "Resend" button to resend the existing uploaded file (image or video) and send it to the server.
Everything works fine when I run it locally on Chrome on mac, the issue appears when I try it on the iPhone, I get this error:
Unhandled Promise Rejection: QuotaExceededError: The quota has been exceeded.
It doesn't work on an Android device either. How can I bypass this error and still keep the functionality to run the app in offline mode?
This is not incognito mode in Safari.
let files = localStorage.files ? JSON.parse(localStorage.files) : [];
files.push(file);
localStorage.files = JSON.stringify(files);