JS execution in TWebBrowser

I accept http://www.foxbase.ru/delphi/javascript-na-delphi.htm and tried my own js code. Some fixes and its just like that: http://shadow-core.com/ShadowJS.pas

First, I don't know where the problem is ... Because in the source code in the example we just 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 smth in my part 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 doesn't get executed, only the defaults:

0
0
1

      

By the way, if I make an 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 the result I want .:

ada4857db7445f789aaacaccdfe69aa6:knjn:W0AR1OiN:287517631
w0b5cc99da3d7a58590359w39b2000w1546f47b90000w3d7a58590359f69ee455fa1a72039b20
9f5172f23c74w78bc586fd3109c321
1

      

The question is, how do I get the twebbrowser to execute and return the values โ€‹โ€‹I want without form events?

0


source to share





All Articles