Re: Setting cookies on InternetExplorer.Application
- From: Csaba Gabor <danswer@xxxxxxxxx>
- Date: Wed, 4 Mar 2009 05:13:46 -0800 (PST)
Um, oh yea, in the hopes that IE just needed a concrete
domain, I tried navigating it to a fake domain
ie.Navigate2 "about:blank"
ie.Navigate2 "http://sureNotToExist.com"
while (ie.ReadyState<4): WScript.Sleep(1): Wend
and then set the cookie. Not surprisingly,
this did not work either. It also didn't work
when I tried to execute the cookie script by
means of a window.setTimeout.
On Mar 4, 1:58 pm, Csaba Gabor <dans...@xxxxxxxxx> wrote:
I have a VBScript application I've written which uses IE for....
display purposes. I figure, why not retain settings for my
app using IE's already built in handler, namely cookie
management? Unfortunately, I'm getting the big goose egg,
nada, nothing, zip.
Here's what I tried.
However, when I convert the above in the hopes.
of using it with the IE that my VBScript app brings up, the
cookie appears to never have been set.
'Run this script in a .vbs file
set ie = CreateObject("InternetExplorer.Application")
ie.Navigate2 "about:blank"
ie.visible = True
cookieScript = _
"var exp = new Date();" & _
"var Mins3 = exp.getTime() + (1000 * 60 * 3);" & _
"exp.setTime(Mins3);" & _
"var newCookie=" & _
"'foo=bar; " & _
"expires=' + exp.toGMTString();" & _
"alert ('setting: ' + newCookie);" & _
"document.cookie = newCookie"
ie.document.parentWindow.execScript cookieScript
MsgBox ie.document.cookie
'ie.Quit()
Of course as it sits, this code would be insufficient
because there is nothing to associate the cookie
with the script being run (ie. WScript.ScriptFullName).
Nevertheless, is there a way to get my basic idea to
work?
Thanks,
Csaba Gabor from Vienna
- References:
- Setting cookies on InternetExplorer.Application
- From: Csaba Gabor
- Setting cookies on InternetExplorer.Application
- Prev by Date: Re: Reading file names and Searching for text
- Next by Date: Re: Setting cookies on InternetExplorer.Application
- Previous by thread: Setting cookies on InternetExplorer.Application
- Next by thread: Re: Setting cookies on InternetExplorer.Application
- Index(es):
Relevant Pages
|