dcef3
dcef3 copied to clipboard
How to retrieve Javascript return value
I want to get return value of a javascript function after I execute it. How can I achieve it? Please help.
I don't know the proper way to do it, but i could achieve this task by using the OnConsoleMessage event of TChromium. So what i do is 'console.log' the result of my JS code, and grab it on this event.
For instance :
function sum(a,b) { var c = a + b; console.log(c); }
The 'c' result will be displayed at the console and you can grab it inside Delphi.
Please somebody help us, I also use OnConsoleMessage event to communicate with web page script, but how to do this correctly without console?. And how to access DOM objects from TForm ? for example I need to access DOM window object, how i do this from a TForm function, like TButton OnClick ?
Hello,
maybe this is the right way explained here: http://stackoverflow.com/questions/6893029/how-to-expose-native-functions-to-javascript-in-a-web-page-using-chromium-and
Unfortunately the register process fails on my machine because "strnlen" cannot be found withing the msvcrt.dll for some reason (I'm using a virtual machine with WinXP). So I can't verify it. :/