Jump to content

Call Javascripts function within uniURLFrame from Delphi


Recommended Posts

Hi,

I have uniURLFrame in my from and set it's URL to a web page.

source code of that page contain a jacascript function let say function F1 to do something on the page.

I would like to know how to call that javascript function from Delphi for example onclick of uniButton on a form.

I have search Google world wide and this forum but can not find the answer,

Please Help,

Thank you 

Whcaharachai

Link to comment
Share on other sites

39 minutes ago, whacharachai said:

I test my program and linked page in my localhost (127.0.0.1 Apache on Windows) Both Program (.dll) and Page are in the root of localhost.

Can you try this?

procedure TMainForm.UniButton1Click(Sender: TObject);
begin
  UniURLFrame1.JSInterface.JSCode(#1'.iframe.contentWindow.yourFunction();');
end;

 

Link to comment
Share on other sites

15 hours ago, Sherzod said:

Can you try this?


procedure TMainForm.UniButton1Click(Sender: TObject);
begin
  UniURLFrame1.JSInterface.JSCode(#1'.iframe.contentWindow.yourFunction();');
end;

 

Thank you very much, the code work fine.

I wonder where can I find the document or example of the JSInterface  like this, so I can study them myself, thank you.

Link to comment
Share on other sites

  • 1 month later...
On 12/12/2019 at 10:11 AM, whacharachai said:

Thank you very much, the code work fine.

I wonder where can I find the document or example of the JSInterface  like this, so I can study them myself, thank you.

what does the parameters mean?

UniURLFrame1.JSInterface.JSCode(#1'.iframe.contentWindow.yourFunction();');

1‘’  ??

iframe ??

contentWindow??

 

Link to comment
Share on other sites

  • 1 year later...
On 12/11/2019 at 12:09 PM, Sherzod said:

Can you try this?



procedure TMainForm.UniButton1Click(Sender: TObject);
begin
  UniURLFrame1.JSInterface.JSCode(#1'.iframe.contentWindow.yourFunction();');
end;

 

@Sherzod, can you do the same for a UniHTMLFrame?

When I do this:

UniHTMLFrame1.JSInterface.JSCode(#1'.iframe.contentWindow.nextStep();');

I get the following error:

opera_2021-03-31_20-16-12.png.3731e036ef60a46ab597515b140a6b49.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...