[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

WebBrowser - OnClick event for " Web Page - History back.go(-1)" Problem

Posted on 2004-10-28
6
Medium Priority
?
1,439 Views
Last Modified: 2008-01-09
Hello All;

  Below is information that I have tried, but has not worked.
( Mention, everything works like it suppose to in "IE" but when used
In code like what I am doing here, it does not work, )

  I have done this to the link.

<A HREF="JavaScript: history.go(-1)" id="history">

I have done this in code
WebBrowser1.Navigate(WideString('javascript:history.click()'));
&
WebBrowser1.Navigate('javascript:history.click()');

I receive an "HTML Page Error" Method not supported.
Within the page itself, not Delphi Error.

So I went in and changed the code in the page ( It is a CGI page, so I had to do some research on how to implement it.
And it is just like regular HTML for <form>'s and <input Type> of parameters )

<FORM>
<INPUT type="Submit" NAME="SpiderHistory" value="Click here to go back" onClick="history.back(-1)" STYLE="color: #000080; border-style: ridge" > 
</FORM>

The above code, works extremely well, and gives the " History - Back " Button a new look, A lot better feel.
And when using it in " IE " it works like it suppose too. ( The page pulls information from a MySQL Database, This goes to the Last Record in the MySQL Database, that I was at )

BUT?? When used in the "WebBrowser" Project,( If I click on the link myself, with "MouseClick" then it works like it suppose too ) but with it placed on the "OnDocumentComplete" it is not going back properly. Instead it is going " All the way " Back to the beginning of the page.
Instead of where I "Last Was" ( so it suppose to go back to the last record, instead It is going back to the <top> of the Table )

This is the code that I am using to implement the "OnClick" Behavior in Delphi's WebBrowser (EmbeddedWB)

====================
procedure TCFF_Spider.AdminWebDocumentComplete(Sender: TObject;
  const pDisp: IDispatch; var URL: OleVariant);
var
  SpiderSubmit : IHTMLInputElement;
  MyDocument : IHTMLDocument3;
begin
   MyDocument := AdminWeb.Document as IHTMLDocument3;
   if assigned(MyDocument) then
   SpiderSubmit := (MyDocument.getElementsByName('SpiderHistory').item(0,'')as IHTMLInputElement);
   if assigned(SpiderSubmit) then
   SpiderSubmit.form.Submit;

end; end;
====================

Any idea's. on Why? This is not working correctly, please help

Thank You
Carrzkiss
0
Comment
Question by:Wayne Barron
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 26

Expert Comment

by:EddieShipman
ID: 12466901
Have you used the click method of the submit button instead of submit?
i.e.
  SpiderSubmit.click;
0
 
LVL 31

Author Comment

by:Wayne Barron
ID: 12469299
Hello Again Eddie;

  It is not giving me the Option of: SpiderSubmit.Click; ?
Undeclaired Identifier.

Carrzkiss
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 12472683
Can you give me a URL or HTML source so I can mock it up here?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 31

Author Comment

by:Wayne Barron
ID: 12472973
Cannot give the URL it is in the "Admin" of a Business site.
The code is CGI/Perl HTML so cannot do much to it.

Here is the actual line.

Original Code
==============
print qq!<P ALIGN="center"><A HREF="javascript: history.go(-1)()"><B><FONT COLOR="BLUE">Back To Previous Window</FONT></B></A></P>!;      
==============

Updated Code to use <FORM> Method
==============
print qq!<P ALIGN="center"><FORM> <INPUT type="submit" NAME="SpiderHistory" onClick="JavaScript:history.go(-1)" value="Click here to go back" STYLE="color: #000080; border-style: ridge"> </FORM> </P>!;      
==============

The Original code is when clicked on with "Mouse" in the WebBrowser Project, works as designed.
But when clicked on it designTime, it takes it back to the beginning
Of the "MySQL" Database Categories.
Instead of going back to the "Previous Database Category" that
I was at previously.
( Hope that makes since to you )

If there is anything else that you may need please let me know.
And I will try to get it for you.

This is a "Internet Search Engine" site. As you can tell by the: Spider
I have made a program that will make it faster to grab links and submit them into the "Spider" of the Search Engine and then [Submit] the Spider to extract the Sites data.

And this problem, is trying to get back to the last page, so that I do not have to start over everytime. (or) hit the Back-Space button.
In the program.

There are MILLIONS upon Millions of sites out there, that I need to get into the Search Engine, and once this program is completed, It should make everything 10x faster...  I am hoping anyway.
As with the program's Site Link Stripper.
I can do about 1000 links in a 5 hour period.
I am hoping that I can double that with this program. If not,
Then it is a waste, having this feature to Submit in it.
Then I will go back to 1000 links manually again.

Sorry for the Book here, just wanted to let you know what the project is for, and why I am so eager to get this Click to work on the "Javascript" History link.

Take Care
Wayne
0
 
LVL 26

Accepted Solution

by:
EddieShipman earned 200 total points
ID: 12476107
Wayne, Have you tried using the GoBack method in TWebBrowser?
0
 
LVL 31

Author Comment

by:Wayne Barron
ID: 12478182
OK< You made me think ???
 
  So I went in and changed "1" single line of code:

OnDocumentComplete

   SpiderSubmit.form.Submit;
To
   AdminWeb.GoBack;

Wa-La...... Works like a complete "EddieShipman" Charm :-)

Thank you for reminding me of something that I have done so many times before. But forgot.

Thank You Once Again
Wayne
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question