我对javascript很新,但我尝试使用谷歌的reCAPTCHA。因此,当reCAPTCHA未验证使用该表单的人是人时,我能够呈现reCAPTCHA但无法使我的表单提交按钮被禁用。目前我添加了以下脚本:
<script type="text/javascript">
var onloadCallback = function() {
grecaptcha.render('g-recaptcha', {
'sitekey' : 'my_site_key'
});
};
var wait = function() {
if(grecaptcha.getResponse() != '') {
alert("is it working?");
document.getElementById("submit_button").disabled = 'disabled';
}
}
</script>
由于
答案 0 :(得分:0)
您可以向渲染参数添加webview.getSettings().setJavaScriptEnabled(true);
webview.getSettings().setDomStorageEnabled(true);
webview.getSettings().setPluginState(WebSettings.PluginState.ON);
webview.setWebChromeClient(new WebChromeClient(){
// Need to accept permissions to use the camera
@Override
public void onPermissionRequest(final PermissionRequest request) {
L.d("onPermissionRequest");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
request.grant(request.getResources());
}
}
});
:
callback