I'm getting a string response from the API of this format
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<form id="formRedirectToPayment" action="http://gate.666666pay.cn/cooperate/gateway.cgi" method="POST" target="_blank">
<input type="hidden" name="amount" value="12.00" />
<input type="hidden" name="clientIp" value="127.0.0.1" />
<input type="hidden" name="expireTime" value="" />
<input type="hidden" name="extra" value="payment" />
<input type="hidden" name="merId" value="2018020911011185" />
<input type="hidden" name="notifyUrl" value="http://fz.zf55555.com:8081/pfpay" />
<input type="hidden" name="service" value="TRADE.H5PAY" />
<input type="hidden" name="sign" value="004ABEFFA5D7458844AB4EAFD7C154BA" />
<input type="hidden" name="summary" value="payment" />
<input type="hidden" name="tradeDate" value="20180302" />
<input type="hidden" name="tradeNo" value="PfQW180302200400018366QP" />
<input type="hidden" name="typeId" value="3" />
<input type="hidden" name="version" value="1.0.0.0" />
</form>
</body>
<script type="text/javascript">
document.getElementById('formRedirectToPayment').submit();
</script>
</html>
Below is the code that sets the webview.
override func viewDidLoad() {
super.viewDidLoad()
if let rootVC = navigationController?.viewControllers.first {
navigationController?.viewControllers = [rootVC, self]
}
setWebView()
}
func setWebView() {
webView.loadHTMLString(htmlString, baseURL: nil)
}
I would only get an empty webview with white background. If this can't work in webview I was thinking of loading the html string to safari, but it seems impossible.