haifengkao / YWebView

WKWebview with persistent cookies support
MIT License
104 stars 26 forks source link

YWebView

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];
}

Usage

Just use YWebView as the ordinary WKWebView.

Example

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

Requirements

iOS 8.0 (the minimum requirement for WKWebView)

Installation

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

pod "YWebView"

Author

Hai Feng Kao, haifeng@cocoaspice.in

License

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