Jump to content
Sign in to follow this  
charon

How to set a cookie

Recommended Posts

charon

I am trying to set a local cookie preferably without opening the browser window.  I can see how to read a cookie but setting a cookie is not clear.

#include <msgboxConstants.au3>
#include <Array.au3>
#include <IE.au3>

Global $oIE = _IECreate("google.com")
Global $oCookie = $oIE.document.cookie

msgbox($MB_SYSTEMMODAL, "", $oCookie) ; check for string

Global $oCookieValues = StringSplit($oCookie, ";")
_ArrayDisplay($oCookieValues) ; check for Array


;$oIE.document.cookie = name1=value1;name2=value2
$oIE.document.cookie = myCookie=test;name2=value2

I think this will set my cookie?

$oIE = _IECreate("www.google.com")

$oIE.document.cookie = "test_cookie=one; path=/;"
ConsoleWrite($oIE.document.cookie & @CRLF)
$oIE.document.cookie = "test_cookie=two; path=/;"
ConsoleWrite($oIE.document.cookie & @CRLF)
_IEQuit($oIE)
Edited by charon

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×