javascript - jQuery .click() event not working in Android WebView -
my simple html code:
<a href="#" onclick="$('#imageupload').click();return false;">photo upload</a> <input type="file" id="imageupload" multiple accept="image/*">
my android mainactivity class in mainactivity.java:
private webview mwebview; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); mwebview = (webview) findviewbyid(r.id.webview); mwebview.loadurl("http://mywebapp/"); websettings websettings = mwebview.getsettings(); websettings.setjavascriptenabled(true); mwebview.setwebviewclient(new webviewclient()); } @override public void onbackpressed() { if(mwebview.cangoback()) { mwebview.goback(); } else { super.onbackpressed(); } }
everything working perfect in chrome desktop , chrome mobile.
but there problem @ webview
is there simple , quick solution
try put
mwebview.loadurl("http://mywebapp/");
after
mwebview.setwebviewclient(new webviewclient());
wiki
Comments
Post a Comment