Packagecom.myflashlab.air.extensions.richWebView.android
Classpublic class Cookies
InheritanceCookies Inheritance Object

Manages the cookies used by an application's WebView instances. Cookies are manipulated according to RFC2109. You can access to a reference of this object from RichWebView.android.cookieManager



Public Properties
 PropertyDefined By
  acceptCookie : Boolean
Sets whether the application's WebView instances should send and accept cookies.
Cookies
  allowFileSchemeCookies : Boolean
Sets whether the application's WebView instances should send and accept cookies for file scheme URLs.
Cookies
  hasCookies : Boolean
[read-only] Gets whether there are stored cookies.
Cookies
Public Methods
 MethodDefined By
  
flush():void
Ensures all cookies currently accessible through the getCookie API are written to persistent storage.
Cookies
  
Gets whether the WebView should allow third party cookies to be set.
Cookies
  
getCookie($url:String):String
Gets the cookies for the given URL.
Cookies
  
removeAllCookies($callback:Function):void
Removes all cookies.
Cookies
  
removeSessionCookies($callback:Function):void
Removes all session cookies, which are cookies without an expiration date.
Cookies
  
setAcceptThirdPartyCookies($webview:WebView, $value:Boolean):void
Sets whether the WebView should allow third party cookies to be set.
Cookies
  
setCookie($url:String, $value:String, $callback:Function):void
Sets a cookie for the given URL.
Cookies
Property Detail
acceptCookieproperty
acceptCookie:Boolean

Sets whether the application's WebView instances should send and accept cookies. By default this is set to true and the WebView accepts cookies. When this is true setAcceptThirdPartyCookies and allowFileSchemeCookies can be used to control the policy for those specific types of cookie.


Implementation
    public function get acceptCookie():Boolean
    public function set acceptCookie(value:Boolean):void
allowFileSchemeCookiesproperty 
allowFileSchemeCookies:Boolean

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. Do not use this feature unless you can be sure that no unintentional sharing of cookie data can take place.


Implementation
    public function get allowFileSchemeCookies():Boolean
    public function set allowFileSchemeCookies(value:Boolean):void
hasCookiesproperty 
hasCookies:Boolean  [read-only]

Gets whether there are stored cookies.


Implementation
    public function get hasCookies():Boolean
Method Detail
flush()method
public function flush():void

Ensures all cookies currently accessible through the getCookie API are written to persistent storage. This call will block the caller until it is done and may perform I/O.

works on Android API 21+

getAcceptThirdPartyCookies()method 
public function getAcceptThirdPartyCookies($webview:WebView):Boolean

Gets whether the WebView should allow third party cookies to be set.

Always return true if Android API is lower than 21

Parameters

$webview:WebView — the WebView instance to get the cookie policy for

Returns
Boolean — true if the WebView accepts third party cookies
getCookie()method 
public function getCookie($url:String):String

Gets the cookies for the given URL.

Parameters

$url:String — the URL for which the cookies are requested

Returns
String — value the cookies as a string, using the format of the 'Cookie' HTTP request header
removeAllCookies()method 
public function removeAllCookies($callback:Function):void

Removes all cookies. The value provided to the callback indicates whether any cookies were removed.

works on Android API 21+

Parameters

$callback:Function — expects a Boolean parameter

removeSessionCookies()method 
public function removeSessionCookies($callback:Function):void

Removes all session cookies, which are cookies without an expiration date. The value provided to the callback indicates whether any cookies were removed.

Parameters

$callback:Function — expects a Boolean parameter

setAcceptThirdPartyCookies()method 
public function setAcceptThirdPartyCookies($webview:WebView, $value:Boolean):void

Sets whether the WebView should allow third party cookies to be set. Allowing third party cookies is a per WebView policy and can be set differently on different WebView instances.

Apps that target Build.VERSION_CODES.KITKAT or below default to allowing third party cookies. Apps targeting Build.VERSION_CODES.LOLLIPOP or later default to disallowing third party cookies.

Parameters

$webview:WebView — the WebView instance to set the cookie policy on
 
$value:Boolean — whether the WebView instance should accept third party cookies

setCookie()method 
public function setCookie($url:String, $value:String, $callback:Function):void

Sets a cookie for the given URL. Any existing cookie with the same host, path and name will be replaced with the new cookie. The cookie being set will be ignored if it is expired. The value provided to the callback indicates whether the cookie was set successfully.

works on Android API 21+

Parameters

$url:String — the URL for which the cookie is to be set
 
$value:String — the cookie as a string, using the format of the 'Set-Cookie' HTTP response header
 
$callback:Function — expects a Boolean parameter