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

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

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 )

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

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);
  SpiderSubmit : IHTMLInputElement;
  MyDocument : IHTMLDocument3;
   MyDocument := AdminWeb.Document as IHTMLDocument3;
   if assigned(MyDocument) then
   SpiderSubmit := (MyDocument.getElementsByName('SpiderHistory').item(0,'')as IHTMLInputElement);
   if assigned(SpiderSubmit) then

end; end;

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

Thank You
LVL 31
Wayne BarronAuthor, Web DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Eddie ShipmanAll-around developerCommented:
Have you used the click method of the submit button instead of submit?
Wayne BarronAuthor, Web DeveloperAuthor Commented:
Hello Again Eddie;

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

Eddie ShipmanAll-around developerCommented:
Can you give me a URL or HTML source so I can mock it up here?
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

Wayne BarronAuthor, Web DeveloperAuthor Commented:
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
Eddie ShipmanAll-around developerCommented:
Wayne, Have you tried using the GoBack method in TWebBrowser?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Wayne BarronAuthor, Web DeveloperAuthor Commented:
OK< You made me think ???
  So I went in and changed "1" single line of code:



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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.