DelphiFAQ Home Search:

Calling a Delphi procedure from Javascript

 

comments4 comments. Current rating: 4 stars (2 votes). Leave comments and/ or rate it.

Question:

In a TWebBrowser, I display a webpage with a javascript function, and i need to call Delphi code from that javascript function. How can I achieve that?

Answer:

Well you can only extend window.external

To do this easily, first stop using TWebBrowser and get TEmbeddedWB which can be found at http://www.euromind.com/iedelphi/embeddedwb.htm.

Then read this http://www.euromind.com/iedelphi/embeddedwb/ongetexternal.htm.


Comments:

2006-02-16, 14:27:49
dgabradelo@fq.uh.cu from Cuba  
rating
In case that you may want to develop a standalone application that contain any kind of information as HTML and javascript in a Webbrowser this components becomes very helpfull if you want the client of your application to interact with the HTML portion of the program and make some decisions in the Delphi platform according to that.
2006-09-21, 16:40:13
anonymous from Bulgaria  
rating
Answer would be more useful if it was about how to call Delphi code from javascript function when using TWebBrowser ( that is what the question was for ).
2007-10-30, 16:49:38
anonymous  
You can supply your own (COM) interface (and it's implementation) and attach it to the TWebbrowser control, and make calls to that interface from javascript. Some googling will provide you good examples!
2007-10-30, 16:54:23
anonymous  

 

 

Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option.
 
It seems that you are
from Washington, US .

Info/ Feedback on this

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:
photo Add a picture:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity. The owner of this web site reserves the right to delete such material.