I want to run a javascript code in TWebbrowser and get the console output of it. For instance, if i run this code in the console :
var a = 2; var b = 3; var c = a +b ; console.log('The result is '+ c);
I get this output on console :
The result is 5
The code i use to run a JS script with TWebbrowser is this :
twebbrowser1.navigate('javascript:var a = 2; var b = 3; var c = a +b ; console.log('The result is '+ c);');
It works, but i don't know how to get the console output. Is there a way to do it ?
Thanks in advance !
IActiveScriptinterface),cscript.exe, or other scripting engine. It is wasteful to use a visual HTML component to perform non-visual script work by itself.javascript:url that has an embedded script. You are not calling a script on a HTML page, soTWebBrowseris the wrong tool to use in your example. If you are doing something different in your real code, you should have shown that instead.