2
我有這樣的WebView,我加載像這樣:電子預加載腳本爲webview不工作?
<webview id="link-view"
src="http://url.espace.com/"
preload="./preload.js"
autosize="on"
partition="persist:link"></webview>
在preload.js文件:我有這個
console.log("test");
這甚至不工作..
可有人說明?
嘗試使用'preload.js'而不是'。/ preloads.js'。 – PatNowak
已嘗試.. – julestruong
對於來自Google的用戶,請確保在動態創建webview時使用setAttribute。這使我感到困惑,因爲它曾經與Electron的舊版本一起工作。因此,而不是webview.preload ='./preload.js'做webview.setAttribute('preload','./preload.js') –