问题
I take http://www.foxbase.ru/delphi/javascript-na-delphi.htm worked example and trying to execute my own js code. Some corrections and its simly like this : http://shadow-core.com/ShadowJS.pas
Firstly , i dont know where is problem... Cuz , in source code in example, we simply use:
js:=TDelphiJS.Create;
js.LoadFromURL('http://vbulletin_forum.ru/clientscript/vbulletin_md5.js?v=371');
js.DeclareVariable('mypassword');
js.DeclareVariable('');
js.DeclareVariable('');
js.DeclareVariable('');
js.Execute('md5hash');
ShowMessage(js.GetVariable(2));
js.free;
I use in my unit smth like this :
js:=TShadowJS.Create;
js.LoadFromURL('http://shadow-core.com/dev/col/test.php');
js.Execute('R()');
Form1.Memo1.Lines.Add (js.GetVariable('TS016c63b6_id'));
Form1.Memo1.Lines.Add (js.GetVariable('TS016c63b6_cr'));
Form1.Memo1.Lines.Add (js.GetVariable('TS016c63b6_76'));
Form1.Memo1.Lines.Add (js.GetVariable('TS016c63b6_86'));
Form1.Memo1.Lines.Add (js.GetVariable('TS016c63b6_md'));
And my js code are not executing , only default values like this:
0
0
1
By the way , if i make event on another button
procedure TForm1.Button2Click(Sender: TObject);
begin
Form1.Memo1.Lines.Add (js.GetVariable('TS016c63b6_id'));
Form1.Memo1.Lines.Add (js.GetVariable('TS016c63b6_cr'));
Form1.Memo1.Lines.Add (js.GetVariable('TS016c63b6_76'));
Form1.Memo1.Lines.Add (js.GetVariable('TS016c63b6_86'));
Form1.Memo1.Lines.Add (js.GetVariable('TS016c63b6_md'));
end;
i got result that i need.:
ada4857db7445f789aaacaccdfe69aa6:knjn:W0AR1OiN:287517631
w0b5cc99da3d7a58590359w39b2000w1546f47b90000w3d7a58590359f69ee455fa1a72039b20
9f5172f23c74w78bc586fd3109c321
1
Thats question , how to make twebbrowser executing and returning values that i need momentaly , without form's events?
来源:https://stackoverflow.com/questions/27081532/executing-js-in-twebbrowser