【发布时间】:2021-01-04 10:28:14
【问题描述】:
我的 html 代码中有以下实现。
<!doctype html>
<html ng-app="app">
<head>
<title>post data</title>
</head>
<body>
<div>
<form action="https://mypaymentgateway/pay" method="post">
<input type="hidden" id="profile_id" name="profile_id" value="123" />
<input type="hidden" id="transaction_id" name="transaction_id" value="abcd" />
<input type="hidden" id="locale" name="locale" value="en" />
<input type="submit" id="btnsubmit" value="Confirm" />
</form>
</div>
</body>
</html>
我想要做的是通过调用我的付款网址(“https://mypaymentgateway/pay”)的 POST 方法在 webview 中提交上述值,而无需点击“确认”按钮。我也尝试过here 和here 以及其他来源的解决方案。但似乎没有任何工作正常。请帮我解决这个问题。
【问题讨论】:
-
你能用JavaScript触发
form.submit()吗? -
是的,这是可能的。我该怎么做?
-
您是想从 webview 外部的 Java 代码中调用它,还是使用 javascript 在 webview 内部调用它?这取决于您何时尝试手动提交表单
标签: java android post android-webview form-data