[英]Android webview doesn't execute javascript function in some mobile device
我有一個webview應用程序,在HUAWEI RNE-L22
和iPhone
上一切正常。 直到我嘗試在samsung SM-G530H
上運行該應用程序,它沒有執行我的javascript功能,但在正常的手機瀏覽器上正常工作。
下面的代碼行不會
function alertFunction(message){
alert(message);
}
$(document).ready(function(){
alertFunction("Welcome");
});
只有這個有效
$(document).ready(function(){
alert("Welcome");
});
我不知道這是從我的android webview還是網站正在加載
最好創建JavascriptInterface:
mWebView.addJavascriptInterface(mWebBridge,“ Android”);
在Bridge類中:
@JavascriptInterface
public void Alert(String msg) {
//Custom Android Dialog
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.