本文介紹了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的電子預加載腳本不起作用?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!