First i tried to use the suggested method for normal WebViews
B4X:
Sub WebView1_PageFinished (Success As Boolean, Url As String)
Dim no As NativeObject
Dim cookies As List = no.Initialize("NSHTTPCookieStorage").RunMethod("sharedHTTPCookieStorage", Null).RunMethod("cookies", Null)
For Each cookie As NativeObject In cookies
Log($"Name: ${cookie.GetField("name")}, value: ${cookie.GetField("value")}"$)
Next
End Sub
but the return was Null.
I also tried to get the cookies using js ("document.cookie"), but the returned cookies, were only a portion, due to HttpOnly restrictions.
Is there any possible way to get all the cookies from a WKWebview?
It looks like it is more complicated / problematic to get the cookies from WKWebView. If this is an important feature for you then go with the standard WebView instead.
Unfortunately I cant use standard WebView, because for the needs of my App to reach a specific Url and make an HTTP request, i have to inject js code and i need the cookies too...
Unfortunately I cant use standard WebView, because for the needs of my App to reach a specific Url and make an HTTP request, i have to inject js code and i need the cookies too...