I have an app that creates a couple of WebView instances and I'd like to have them operate as independently as possible.
At the very least, I don't want them sharing cookies. A quick google search gave me results liking "you can't." I'm hoping someone has a better answer.
The basic answer is "you can't".
After looking at this for a bit, I think it's possible, but extremely complicated. It would involve implementing a resourceLoadDelegate on your WebView that implements -webView:resource:willSendRequest:redirectResponse:fromDataSource:
and modifies the request to turn off HTTPShouldHandleCookies
and adds any relevant cookies to the request manually. It also has to implement -webView:resource:didReceiveResponse:fromDataSource:
to find out about any cookies returned from the server. You can alloc/init your own copy of NSHTTPCookieStorage
per-webview and use that to store/retrieve the cookies.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With