Webview localStorage gets cleared if navigate away from page on iOS

I'm experiencing an issue with WKWebView and localStorage. I've set up a standard WKWebView with the configuration:

configuration.websiteDataStore = WKWebsiteDataStore.default()

Everything works fine in the emulator (iOS 16.x, 17.0), but on my iPhone 13 running iOS 17.4, I encounter a problem. When I set a localStorage value on my local HTML page, navigate to another URL within the webview, and then return to the original page, the localStorage is cleared. This behavior is new and wasn't happening before. Has anyone else encountered this or have any suggestions on how to fix it? The localstorage should be persistent as it always has been.

Having the same issue. I can see the only recent changes we made to our app were related to App Privacy. You manage to figure out what was wrong?

Webview localStorage gets cleared if navigate away from page on iOS
 
 
Q