用于webview的电子预加载脚本不起作用? [英] Electron preload script for webview not working?
本文介绍了用于webview的电子预加载脚本不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这样加载的网络视图:
I have this webview that I load like this:
<webview id="link-view"
src="http://url.espace.com/"
preload="./preload.js"
autosize="on"
partition="persist:link"></webview>
在preload.js文件中:我有这个
In the preload.js file : I have this
console.log("test");
这甚至不起作用。.
有人可以解释吗?
推荐答案
我刚刚尝试了相同的情况,并且按预期工作。
I just tried the same scenario, and it worked as expected.
是否打开了< webview>
开发工具?由于< webview>
具有自己的开发工具,所以这是我能看到预加载脚本没有显示 console.log的唯一原因。
输出。可以通过以下方式打开它们:
Do you have the <webview>
dev tools open? As a <webview>
has its own dev tools, That would be the only reason i can see for the preload script not showing the console.log
output. They can be opened by:
var webview = document.getElementById("link-view");
webview.openDevTools();
或者您的脚本路径不正确,我怀疑您对此有把握。
Or your path to the script is incorrect, which i doubt as you seem sure about that.
这篇关于用于webview的电子预加载脚本不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文