Click here to Skip to main content
13,056,229 members (73,636 online)
Rate this:
Please Sign up or sign in to vote.

I'm implementing an application which navigate on a website, using Delphi Twebbrowser object: as final step, there's a link to click. The event associated with the link is my nightmare, because:

- if I try to fire the event (parentWindow.ExecScript) or to click on the link, I get
an error: something like "the object is null"...if I select to continue the excecution, nothing happens.

- While...if I don't click on the link by code, and I do it with the mouse click, the script open a new window and it works fine.

I also wrote an handler for "OnNewWindow2": if I click on the link with mouse, the event fires...but by code, it sleeps...

Is there someone can help me? PLEASE HELP ME!

Thanks a lot...I hope you understand my poor english...
Posted 7-Oct-12 23:28pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You need to check if the link is an actual url, or if it is a javascript link.

First check out this link, describing how to determine what kind of link needs to be handled.[^]

Here some extra info on executing javascript:[^]

The most important is the first, because I think you are now executing an actual link as javascript.

If you need more help, please edit this question and add some code.

Good luck!
fRenatoNapoli 8-Oct-12 8:42am
I've got news: if I try this code
(allLinks.Item(63,'') as IHTMLElement).click; //Javascript Excel Link
I get another type of error (Sys.InvalidOperationException: the report or page is being updated. Please wait for the current action to complete)...
While without Application.ProcessMessages, the error is "object is null"...
So I think I've to wait before click on the link...but how to do it?
Thanks, please help me...
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Hi, thanks for your answer...but I'm still living my nightmare :-)

The link is a javascript link, this is the code:


Please help me! :-)
Rate this: bad
Please Sign up or sign in to vote.

Solution 4

Well... Finally I got my Excel document...

The code didn't work due page wasn't completly downloaded yet: I'have fired a "onDownloadComplete" in the point of code where I was clicking. In "onDownloadComplete", I do use and it works fine...

Thank you, see you soon :-)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170728.2 | Last Updated 8 Oct 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100