What is your question now? In the header, you are asking how to execute JavaScript. Try the following:
uses MSHTML_TLB, SHDocVw, ShellAPI; function ExecuteScript(doc: IHTMLDocument2; script: string; language: string): Boolean; var win: IHTMLWindow2; Olelanguage: Olevariant; begin if doc <> nil then begin try win := doc.parentWindow; if win <> nil then begin try Olelanguage := language; win.ExecScript(script, Olelanguage); finally win := nil; end; end; finally doc := nil; end; end; end;
Sample Usage:
IDoc: IHTMLDocument2; Webbrowser1.Document.QueryInterface(IHTMLDocument2, iDoc); ExecuteScript(iDoc, 'document.login.submit()', 'JavaScript');
(Hereinafter can be found here ).
Then in the text you ask how to use cookies (when using TWebBrowser this should happen automatically). When using Indy HTTP, you just need to attach the TIdCookieManager to your TIdHTTPClient instance, that's all (but you probably don't want to use it anyway due to the script requirement ....)
Leo
source share