How to share state/data between a PWA in iOS Safari and standalone mode

You may know a few common use cases for storing data in Local Storage, Session Storage or Cookies. For instance, users log in to your web app and you want to save a token until they log out. You could also store user settings, such as a preferred language or color theme(Light/Dark).

The issue

A progressive web application in iOS Safari can be added to homescreen and then be opened in standalone/fullscreen mode with the look of native app. However, there’s a catch in using the…