我正面临一个严重的 android OS Jelly Bean 4.2 错误,在我的程序中,我使用 JavaScript 来获取网页的高度,它从 android 2.2 到 4.1 完美运行,但是当我尝试使用相同的代码时android 4.2 所以 JavaScript 接口(interface)不能工作。
我该如何解决这个问题?
最佳答案
来自 Android 4.2 文档:
Caution: If you've set your targetSdkVersion to 17 or higher, you must add the @JavascriptInterface annotation to any method that you want available your web page code (the method must also be public). If you do not provide the annotation, then the method will not accessible by your web page when running on Android 4.2 or higher.
关于Javascript 界面不适用于 android 4.2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13775320/