CookieManager.SetAcceptFileSchemeCookies(Boolean) Method

Definition

Sets whether the application's WebView instances should send and accept cookies for file scheme URLs.

[Android.Runtime.Register("setAcceptFileSchemeCookies", "(Z)V", "")]
public static void SetAcceptFileSchemeCookies (bool accept);
[<Android.Runtime.Register("setAcceptFileSchemeCookies", "(Z)V", "")>]
static member SetAcceptFileSchemeCookies : bool -> unit

Parameters

accept
Boolean
Attributes

Remarks

Sets whether the application's WebView instances should send and accept cookies for file scheme URLs.

Use of cookies with file scheme URLs is potentially insecure and turned off by default. All file:// URLs share all their cookies, which may lead to leaking private app cookies (ex. any malicious file can access cookies previously set by other (trusted) files). <p class="note"> Loading content via file:// URLs is generally discouraged. See the note in WebSettings#setAllowFileAccess. Using androidx.webkit.WebViewAssetLoader to load files over http(s):// URLs allows the standard web security model to be used for setting and sharing cookies for local files.

Note that calls to this method will have no effect if made after calling other CookieManager APIs.

This member is deprecated. This setting is not secure, please use androidx.webkit.WebViewAssetLoader instead.

Java documentation for android.webkit.CookieManager.setAcceptFileSchemeCookies(boolean).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to