请帮助我,加载此代码后如何调用提交动作html
。
WebView webView = (WebView) findViewById(R.id.webview);
String formData = "<!DOCTYPE html>\n" +
"<html xmlns=\"http://www.w3.org/1999/xhtml\">\n" +
"<head>\n" +
"<title>SSO OutBound Settings</title>" +
"</head>\n" +
"<body>" +
"<form name='frmMain' id=\"frmMain\" runat='server' method='POST'" +
"action='" + ---data--- + "'>" +
"<input type='hidden' name='" + ---data--- + "'" +
"value='" + ---data--- + "'/>" +
"<input type='hidden' runat='server' name='" + ---data--- + "' " +
"value='" + ---data--- + "'/>" +
"</form>" +
"</body>\n" +
"</html>";
webView.loadData(formData, "text/html", "UTF-8");
我认为您需要使用javascript执行此操作。因此,必须为您的Web视图启用它:
webView.getSettings().setJavaScriptEnabled(true);
提交表格应该是这样的:
webView.loadUrl("javascript:document.frmMain.submit()");
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句