如何加载js文件并在CEF上执行 [英] how to load a js file and execute it on CEF
问题描述
我使用CEF(铬嵌入框架)加载html页面:
<!DOCTYPE html>< html>< head></head><身体>< script src ="phantom-limb.js" type ="text/javascript"></script></body></html>
,它可以正常工作.现在,我将页面修改如下:
<!DOCTYPE html>< html>< head></head><身体></body></html>
然后在cef加载它之后,我使用cef的ExecuteJavaScript方法执行相同的phantom-limb.js,但是什么也没有出现.
如何加载js文件并执行,或者js文件有一定限制?
thx:)
如您在 and it works ok. now, I modify the page as follow: and after cef loaded it, I use cef's ExecuteJavaScript method to execute the same phantom-limb.js, but nothing appear. how can I load the js file and execute, or, the js file has some limit? thx:) As you can see at the end of the source code of you JS file, the In this way a listener to the So, you just have to append the line 这篇关于如何加载js文件并在CEF上执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!<!DOCTYPE html>
<html>
<head>
</head>
<body>
</body>
</html>
startOnLoad
config parameter is set to true
by default.DOMContentLoaded
is added, which is never called because your page is already loaded.start();
to your source code, then call your ExecuteJavaScript
and it will work even after the page is loaded.