首页 > 解决方案 > 如何在 react-native 中通过 webview 提交 html 表单

问题描述

我通过 fetch 在 react-native 中获得了一个网页。网页是这样的:

<html><body onload="document.forms[0].submit();"><form action='XXX' method="post"><input type="hidden" name="keywords" value='hello' /></form></html>

. 那么我怎样才能在 react-native 中发布这个网页呢?

标签: htmlreact-nativewebview

解决方案


由 WebView 解决。像这样:

<WebView source={{html:'<html><body onload="document.forms[0].submit();"><form action='XXX' method="post"><input type="hidden" name="keywords" value='hello' /></form></html>
'}}></WebView>.

推荐阅读