programmatic clicking and new windows

C

Csaba Gabor

Subject to the popup blocker, the code below will bring up
two instances of IE. The first one is identified by the
variable ie below. What is the cleanest way to get
ahold of the second one that gets created in the
last line (lnk.click)?

Also, is there a cleaner way to force ie to bring
up the new page in a new IE besides modifying
the DOM (by putting in lnk.target = "_blank")?
What I'm getting at by this is a possible snythetic
click.

Thanks for any ideas,
Csaba Gabor from Vienna

PS. I know that I can explicitly create an IE and then
tell it to Navigate2 to site implied by the lnk.href,
but I'd rather have IE do the work for me.

Set ie=CreateObject("InternetExplorer.Application")
ie.visible=true
ie.Navigate2 ("about:blank")
While ie.ReadyState<4: WScript.Sleep 200: Wend

demoPage = _
"<a id=mylink href='http://google.com'>foo</a>"

ie.document.body.innerHTML = demoPage
Set lnk = ie.document.getElementById("mylink")
lnk.target = "_blank"
lnk.click
 
A

Anthony Levensalor

On 1/11/2008 1:10 PM, Csaba Gabor wrote:
[snip]
Set ie=CreateObject("InternetExplorer.Application")
ie.visible=true
ie.Navigate2 ("about:blank")
While ie.ReadyState<4: WScript.Sleep 200: Wend

demoPage = _
"<a id=mylink href='http://google.com'>foo</a>"

ie.document.body.innerHTML = demoPage
Set lnk = ie.document.getElementById("mylink")
lnk.target = "_blank"
lnk.click

And what happens to users using FireFox, Netscape, Opera, Konquerer,
Safari, and the rest?

If you're not 100% sure no one using another browser is going to come to
your site, this is broken before you start, unfortunately.

~A!
 
T

Thomas 'PointedEars' Lahn

Csaba said:
Set ie=CreateObject("InternetExplorer.Application")
ie.visible=true
ie.Navigate2 ("about:blank")
While ie.ReadyState<4: WScript.Sleep 200: Wend

demoPage = _
"<a id=mylink href='http://google.com'>foo</a>"

ie.document.body.innerHTML = demoPage
Set lnk = ie.document.getElementById("mylink")
lnk.target = "_blank"
lnk.click

That is VBScript, not J(ava)Script.


PointedEars
 
C

Csaba Gabor

On 1/11/2008 1:10 PM, Csaba Gabor wrote:
[snip]
Set ie=CreateObject("InternetExplorer.Application")
ie.visible=true
ie.Navigate2 ("about:blank")
While ie.ReadyState<4: WScript.Sleep 200: Wend
demoPage = _
"<a id=mylink href='http://google.com'>foo</a>"
ie.document.body.innerHTML = demoPage
Set lnk = ie.document.getElementById("mylink")
lnk.target = "_blank"
lnk.click

And what happens to users using FireFox, Netscape, Opera, Konquerer,
Safari, and the rest?

If you're not 100% sure no one using another browser is going to come to
your site, this is broken before you start, unfortunately.

~A!

I inadvertantly posted to the wrong group
(I started the post in the javascript group,
then realized that there was a vbscript
issue in there, revised the code externally,
then pasted into the wrong window) in
groups.google.com and when I realized my
mistake about 5 minutes later I deleted the
post. But the first line of code with 'Set'
showed that it was not javascript - this is
meant for a .vbs file, hence 100% sure it's IE only.

The properly posted thread, with replies, is found at
http://groups.google.com/group/micr....vbscript/browse_frm/thread/b880daf7521c5f81/

Csaba Gabor from Vienna
 
A

Anthony Levensalor

On 1/13/2008 3:59 PM, Csaba Gabor wrote:
[snip]
I inadvertantly posted to the wrong group
(I started the post in the javascript group,
then realized that there was a vbscript
issue in there, revised the code externally,
then pasted into the wrong window) in
groups.google.com and when I realized my
mistake about 5 minutes later I deleted the
post. But the first line of code with 'Set'
showed that it was not javascript - this is
meant for a .vbs file, hence 100% sure it's IE only.

Fair enough. Good luck with everything. :)

~A!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top