This is related to Bug 140191 but while there seems to be basic cookie access now available in WKWebView, it doesn't work on initial app load. Steps to Reproduce: - Create a trivial WKWebView app (mine is a Cordova app using WKWebView) - In javascript, execute an XHR that receives a session cookie - Execute another XHR and notice that the session cookie is not sent - Background, then foreground the app - Now it will work as expected I've worked around this by executing an XHR in native code before attempting further XHRs in javascript, but even then, I must wait ~2s before attempting the XHR in javascript. Otherwise the cookies seem to be forgotten again, indefinitely, until either the app is backgrounded or I wait long enough after the native-code XHR.
Cordova bugs: https://issues.apache.org/jira/browse/CB-12074 https://github.com/Telerik-Verified-Plugins/WKWebView/issues/247
<rdar://problem/34702882>
We know that XHR can set a session cookie in Safari. So we need a more complete description or a test application to demonstrate a case where XHR can’t set a session cookie. Can you upload a test app demonstrating this bug?
This is still an issue, is there any update? I see a previous comment was looking for a sample app, is that still desired in order for the webkit team to investigate? It seems like cookies from XHR requests aren't reliably set to the WK cookie store (backgrounding or restarting the app seems to sync them). Good description here: https://stackoverflow.com/a/49534854/2757879 Also some related/relevant discussion for Ionic/Cordova users: https://github.com/ionic-team/cordova-plugin-ionic-webview/issues/22 I'd like to know what I can do to help get this one resolved. Thanks!
Created attachment 379741 [details] wkwebview session storage glitch app example Attached is a simple Cordova app that attempts to incorporate the wkwebview engine. We're currently trying to switch from uiwebview to fix issues with iOS video playback, but are having issues with the users not being able to log in on the initial app launch. username: injoytester@gmail.com password: password
(In reply to tleach from comment #5) > Created attachment 379741 [details] > wkwebview session storage glitch app example > > Attached is a simple Cordova app that attempts to incorporate the wkwebview > engine. We're currently trying to switch from uiwebview to fix issues with > iOS video playback, but are having issues with the users not being able to > log in on the initial app launch. If your login issues are related to cookies please check this issue: https://bugs.webkit.org/show_bug.cgi?id=200857
Sorry, I meant source code that conforms to the original description: Steps to Reproduce: - Create a trivial WKWebView app (mine is a Cordova app using WKWebView) - In javascript, execute an XHR that receives a session cookie - Execute another XHR and notice that the session cookie is not sent - Background, then foreground the app - Now it will work as expected