Platforms to show: All Mac Windows Linux Cross-Platform

Back to ChromiumCookieManagerMBS class.

ChromiumCookieManagerMBS.AllCookies as ChromiumCookieMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method HTMLViewer Win MBS Win Plugin 15.2 ❌ No ✅ Yes ❌ No ❌ No Desktop only
Visit all cookies.
Example
Var m as new ChromiumCookieManagerMBS
Var cookies() as ChromiumCookieMBS = m.AllCookies
MsgBox str(cookies.Ubound+1)+" cookies"

The returned cookies are ordered by longest path, then by earliest creation date. Returns false (0) if cookies cannot be accessed.

ChromiumCookieManagerMBS.Constructor

Type Topic Plugin Version macOS Windows Linux iOS Targets
method HTMLViewer Win MBS Win Plugin 15.2 ❌ No ✅ Yes ❌ No ❌ No Desktop only
The constructor.

Can raise exception if no cookie manager is available, e.g. when calling on Linux or Mac OS X or Windows if you don't have the dlls.
May not work if the Chromium was not initialized before by Xojo.

See also:

ChromiumCookieManagerMBS.Constructor(path as string, PersistSessionCookies as Boolean)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method HTMLViewer Win MBS Win Plugin 16.4 ❌ No ✅ Yes ❌ No ❌ No Desktop only
The constructor for a new cookie manager.

Can raise exception if no cookie manager is available, e.g. when calling on Linux or Mac OS X or Windows if you don't have the dlls.
May not work if the Chromium was not initialized before by Xojo.

See also:

ChromiumCookieManagerMBS.DeleteAllCookies as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method HTMLViewer Win MBS Win Plugin 15.2 ❌ No ✅ Yes ❌ No ❌ No Desktop only
Deletes all cookies.

Returns number of deleted cookies.

ChromiumCookieManagerMBS.DeleteCookie(URL as string, CookieName as string) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method HTMLViewer Win MBS Win Plugin 15.2 ❌ No ✅ Yes ❌ No ❌ No Desktop only
Delete all cookies that match the specified parameters.

If both url and values cookieName are specified all host and domain cookies matching both will be deleted. If only |url| is specified all host cookies (but not domain cookies) irrespective of path will be deleted. If url is empty all cookies for all hosts and domains will be deleted. Returns false if a non-empty invalid URL is specified or if cookies cannot be accessed.
Returns true on success.

ChromiumCookieManagerMBS.DeleteCookies(URLs() as string, CookieNames() as string) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method HTMLViewer Win MBS Win Plugin 15.2 ❌ No ✅ Yes ❌ No ❌ No Desktop only
Deletes several cookies.

Same as DeleteCookie, but with arrays for parameters.
Returns number of successful delete attempts.

ChromiumCookieManagerMBS.DeleteURLCookies(URL as String, HTTPOnly as boolean = false) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method HTMLViewer Win MBS Win Plugin 15.2 ❌ No ✅ Yes ❌ No ❌ No Desktop only
Deletes all cookies for a given URL.

The cookies to delete are filtered by the given url scheme, host, domain and path. If includeHttpOnly is true HTTP-only cookies will also be included in the deletion.
Returns number of cookies deleted.

Some examples using this method:

ChromiumCookieManagerMBS.Destructor

Type Topic Plugin Version macOS Windows Linux iOS Targets
method HTMLViewer Win MBS Win Plugin 15.2 ❌ No ✅ Yes ❌ No ❌ No Desktop only
The destructor.

ChromiumCookieManagerMBS.SetCookie(URL as string, cookie as ChromiumCookieMBS) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method HTMLViewer Win MBS Win Plugin 15.2 ❌ No ✅ Yes ❌ No ❌ No Desktop only
Sets a cookie given a valid URL and explicit user-provided cookie attributes.
Example
Var d as new date
Var c as new ChromiumCookieMBS

c.Domain = "www.mbsplugins.de"
c.Path = "/"
c.CreationDate = d
c.LastAccessDate = d
c.ExpirationDate = nil
c.Value = "test "+d.SQLDateTime
c.Name = "test"
c.Secure = false
c.HTTPonly = false

if CookieManager.SetCookie(c.URL, c) then
msgbox "OK"
else
MsgBox "Failed to add cookie"
end if

This function expects each attribute to be well-formed. It will check for disallowed characters (e.g. the ';' character is disallowed within the cookie value attribute) and will return false without setting the cookie if such characters are found.

ChromiumCookieManagerMBS.SetCookies(URL() as string, cookies() as ChromiumCookieMBS) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method HTMLViewer Win MBS Win Plugin 15.2 ❌ No ✅ Yes ❌ No ❌ No Desktop only
Sets a lot of cookies.

Same as SetCookie, but with arrays of URLs and cookie objects.
Returns number of cookies created successfully.

ChromiumCookieManagerMBS.SetStoragePath(Path as string) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method HTMLViewer Win MBS Win Plugin 15.2 ❌ No ✅ Yes ❌ No ❌ No Desktop only
Sets the directory path that will be used for storing cookie data.
Example
Var CookieManager as ChromiumCookieManagerMBS // property of window/app

Var f as FolderItem = SpecialFolder.Desktop.Child("cookies")
f.CreateAsFolder

CookieManager = new ChromiumCookieManagerMBS

if CookieManager.SetStoragePath(f.NativePath) then
MsgBox "OK"
else
MsgBox "Failed"
end if

If path is empty data will be stored in memory only.
Returns false if cookies cannot be accessed.

ChromiumCookieManagerMBS.URLCookies(URL as String, HTTPOnly as boolean = false) as ChromiumCookieMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method HTMLViewer Win MBS Win Plugin 15.2 ❌ No ✅ Yes ❌ No ❌ No Desktop only
Queries a subset of cookies.

The results are filtered by the given url scheme, host, domain and path. If includeHttpOnly is true HTTP-only cookies will also be included in the results. The returned cookies are ordered by longest path, then by earliest creation date. Returns empty array if cookies cannot be accessed.
Returns nil on any error like low memory.

Some examples using this method:

The items on this page are in the following plugins: MBS Win Plugin.


The biggest plugin in space...