美文网首页
webview加载html然后自动提交表单

webview加载html然后自动提交表单

作者: 辛乐 | 来源:发表于2019-10-21 14:31 被阅读0次

手动拼接的html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Simplex</title>
</head>
<body>
<form id='payment_form' action='https://sandbox.test-simplexcc.com/payments/new' method='POST' target='_self'>
<input type='hidden' name='version' value='1'>
<input type='hidden' name='partner' value='bithumbwallet'>
<input type='hidden' name='payment_flow_type' value='wallet'>
<input type='hidden' name='return_url' value='https://www.baidu.com'>
<input type='hidden' name='quote_id' value='cb8d6fe2-ccd2-4df7-8a16-649eddc220e8'>
<input type='hidden' name='payment_id' value='22764f43-26a0-4c1e-a73e-5f339ad99ab5'>
<input type='hidden' name='user_id' value='48215499339362304'>
<input type='hidden' name='destination_wallet[address]' value='1K6A36HrN8RHckFJMjD1q2uWPAXR3wepeb'>
<input type='hidden' name='destination_wallet[currency]' value='BTC'>
<input type='hidden' name='fiat_total_amount[amount]' value='10979.35'>
<input type='hidden' name='fiat_total_amount[currency]' value='USD'>
<input type='hidden' name='digital_total_amount[amount]' value='1.0'>
<input type='hidden' name='digital_total_amount[currency]' value='BTC'>
</form>
</body>
<script>
     window.onload=function(){
        var id=document.getElementById('payment_form');
        id.submit()
    }
</script>
</html>

webview加载html

self.webView.loadHTMLString(HTMLStr, baseURL:nil)

注意点:
1.var id=document.getElementById('payment_form'); 获得对应的表单
2.id.submit() 表单提交

相关文章

网友评论

      本文标题:webview加载html然后自动提交表单

      本文链接:https://www.haomeiwen.com/subject/dedmyctx.html