[英]how do you call javascript from native android code
i know that, from this website, in order to call javascript function of a webpage from android is webview.loadUrl("javascript:CALLME()") 我知道,从这个网站上,为了从android调用网页的javascript函数是webview.loadUrl(“ javascript:CALLME()”)
my question is, i need to first load the page first where i have my javasctip function CALLME() defined right? 我的问题是,我需要先加载页面,在此我定义了javasctip函数CALLME()正确吗?
in other words 换一种说法
i should have 我应该
webview.loadUrl("http://myweb.com/web.html) // web.html has javascript CALLME() defined
webview.loadUrl("javascript:CALLME()");
right?? 对??
apparently, CALLME() is not getting called 显然,没有调用CALLME()
please help 请帮忙
你检查了吗?
webview.getSettings().setJavaScriptEnabled(true);
Like this: 像这样:
myWebView.loadUrl("javascript:$.mobile.showPageLoadingMsg()");
provided you have 只要你有
WebSettings webSettings = myWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.