-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Due to the way that ITP (Intelligent Protection Tracking) works in Safari, all script accessible storage is purged. This means all the local-only content (Stored in localStorage) is removed. If the user interacts by clicking a button (E.g., show the add dialog or about dialog) reset.
Given the nature of this website, thats unlikely — you just visit, see the content, and then move on: You don’t interact.
To address this, we need to try using non-script accessible cookies. E.g., HttpOnly. We’ll do this by making changes that introduce a netlify function (e.g., a service), and consume it in the web page that exists today.
Netlify Function behaviour:
- Creating a service function that receives JSON data, encodes it in Base64, and sets it as a cookie in the response
- If the request is made without parameters (e.g. no body in the request), the requests cookies will be inspected, and if they are present will be base64 decoded, and returned in the response body.
Web Page behaviour changes:
- Whenever a change to the countdowns are made, as well as persisting those changes to local storage like they do today, they will also be posted to the service, which will set the cookie
- When the page loads, if localStorage is empty a request will be made to the service to determine if there is data stored in the
HttpOnlycookies. If data is returned, that will be added to local storage (but won’t rountrip it again!) and the visible countdowns will be updated (similar to when one is added/removed today)
Note, while in scenario (2) (E.g. no local storage) the page shouldn’t display anything)