How to call Delphi code from scripts running in a TWebBrowser (part 6 of 6)

Summary, references and feedback


In this article we have investigated how to call into Delphi code from JavaScript running in a TWebBrowser control.

We began by learning about the browser's external object and looked at how we can extend it using a COM automation object that is registered with the browser control. We reused code from a previous article that enables us to perform this registration.

Next we examined how the methods of the external object are called from JavaScript.

Finally a simple case study program was developed that exercised the code we had developed and demonstrated Delphi code being called from within the web browser control. The source code of the case study was made available for download.


The following resources from the Microsoft® Developer Network Library were used in researching this article:

The article also depends heavily on information provided in this companion DelphiDabbler article:


I hope you found this article useful.

If you have any comments or queries, or if you wish to report any errors or bugs, please get in touch.