mobileFX WebKitX CEF3 ActiveX 4.x
WebKitXCEF3Lib ActiveX Control / WebKitXCEF3 Object / SetCookie Method

The URL of the cookie to set.

The name of the cookie.

The domain of the cookie.

The path of the cookie (should be at least "/")

The value of the cookie.

If True the cookie is for HTTP protocol use only.

If True the cookie is for HTTPS use only.

The UTC expiration date of the cookie.

In This Topic
    SetCookie Method
    In This Topic
    Description

    Sets a cookie given a valid URL and explicit user-provided cookie attributes.

    Syntax
    Visual Basic
    Public Sub SetCookie( _
       ByVal url As String, _
       ByVal CookieName As String, _
       ByVal CookieDomain As String, _
       ByVal CookiePath As String, _
       ByVal CookieValue As String, _
       ByVal CookieHttpOnly As Boolean, _
       ByVal CookieSecure As Boolean, _
       ByVal CookieExpirationDateUTC As String _
    ) 
    Parameters
    url

    The URL of the cookie to set.

    CookieName

    The name of the cookie.

    CookieDomain

    The domain of the cookie.

    CookiePath

    The path of the cookie (should be at least "/")

    CookieValue

    The value of the cookie.

    CookieHttpOnly

    If True the cookie is for HTTP protocol use only.

    CookieSecure

    If True the cookie is for HTTPS use only.

    CookieExpirationDateUTC

    The UTC expiration date of the cookie.

    Remarks

    Sets a cookie given a valid URL and explicit user-provided cookie attributes. 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 fail without setting the cookie if such characters are found.

    You should flush cookies store before calling GetCookies.

    Example
    Private Sub wxDesigner_OnCreate(ByVal Settings As WebKitXCEF3Lib.ISettings, CommandLineSwitches As String)
        
        Settings.persist_session_cookies = 1
        Settings.persist_user_preferences = 1
        Settings.cache_path = App.Path + "\Cache"
        Settings.local_storage = True
        
    End Sub
    
    Private Sub wxDesigner_OnPageComplete(ByVal URL As String)
        
        Dim Cookies As Variant
        Cookies = wxDesigner.GetCookies("webkitx.com")
       
        wxDesigner.SetCookie "https://www.webkitx.com", "test", "webkitx.com", "/", "test_value", True, True, DateAdd("yyyy", 1, Date)
        
        wxDesigner.DeleteCookies "https://www.webkitx.com", "test"
        
        wxDesigner.FlushCookiesStore
    
    End Sub
    See Also