代码之家  ›  专栏  ›  技术社区  ›  Peter

Android webview在某些移动设备上不执行javascript功能

  •  0
  • Peter  · 技术社区  · 8 年前

    我有一个webview应用程序,一切都很好 HUAWEI RNE-L22 iPhone 也直到我尝试在上运行应用程序 samsung SM-G530H

    下面的代码行将不会显示

    function alertFunction(message){
     alert(message);
    }
    $(document).ready(function(){
        alertFunction("Welcome");
    });
    

    只有这样才行

    $(document).ready(function(){
        alert("Welcome");
    });
    

    我不知道这是从我的android网络视图还是网站加载的

    1 回复  |  直到 8 年前
        1
  •  0
  •   kuber singh    8 年前

    创建JavascriptInterface的最佳方法:

    @JavascriptInterface
    public void Alert(String msg) {
        //Custom Android Dialog
    }