WKWebview with persistent cookies support


CI Status Coverage Status Version License Platform

The primary codes are copied from an answer of SO. All cookies will be loaded from NSHTTPCookieStorage. When a web page is loaded, its cookies will be save to NSHTTPCookieStorage as well. This method allows cookie sharing among multiple WKWebView and UIWebView.

If you want to remove all cookies, use

NSHTTPCookieStorage *cookieStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
for (NSHTTPCookie *cookie in cookieStorage.cookies) {
    [cookieStorage deleteCookie:cookie];


Just use YWebView as the ordinary WKWebView.


To run the example project, clone the repo, and run pod install from the Example directory first.


iOS 8.0 (the minimum requirement for WKWebView)


YWebView is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "YWebView"


Hai Feng Kao, [email protected]


YWebView is available under the MIT license. See the LICENSE file for more info.

Please refer to errornoerror.com for more similar questions