Re: How to know Javascript executed and return values
Posted: Wed Mar 20, 2019 4:36 pm
Hi,
Follow these steps :
The JSRTTIExtension and JSExtension demos don't send a Windows message from TChromium.OnProcessMessageReceived to the main form to keep it as simple as possible but it's recommended to do it. Specially if you need to modify any VCL component when the browser receives the process message.
Read the code comments in those demos for more information and read the CEF3 document describing extensions here :
https://bitbucket.org/chromiumembedded/ ... gration.md
Follow these steps :
- Register a JavaScript extension as described in the JSRTTIExtension or JSExtension demos.
- Modify your JavaScript code to call the extension function when your JavaScript code has completed its work.
- Send a process message in the JavaScript extension function to send a process message to the browser process.
- Use the TChromium.OnProcessMessageReceived event to receive the message from the extension.
- Since TChromium.OnProcessMessageReceived is executed in a different thread, I would send a Windows message from that event to the main form to notify your application that your JavaScript code has ended.
The JSRTTIExtension and JSExtension demos don't send a Windows message from TChromium.OnProcessMessageReceived to the main form to keep it as simple as possible but it's recommended to do it. Specially if you need to modify any VCL component when the browser receives the process message.
Read the code comments in those demos for more information and read the CEF3 document describing extensions here :
https://bitbucket.org/chromiumembedded/ ... gration.md