Mike
Mike

Reputation: 251

Changing cookie policy on UIWebView

Is the policy on iOS UIWebview is to accept all cookies by default or to block them?

If it is to block, how would I change this policy?

Thanks

Michael

Upvotes: 1

Views: 1891

Answers (1)

Alon Amir
Alon Amir

Reputation: 5035

The cookie policy is managed by:

[NSHTTPCookieStorage sharedHTTPCookieStorage].cookieAcceptPolicy

And the default value is:

NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain

Which is, to accept cookies only from your main document domain (the domain of the currently opened html document).

The relevant enum is:

typedef NS_ENUM(NSUInteger, NSHTTPCookieAcceptPolicy) {
    NSHTTPCookieAcceptPolicyAlways,
    NSHTTPCookieAcceptPolicyNever,
    NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain
};

Upvotes: 2

Related Questions