【问题标题】:how to submit a html form by webview in react-native如何在 react-native 中通过 webview 提交 html 表单
【发布时间】:2018-09-05 07:49:39
【问题描述】:

我通过 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 中发布这个网页呢?

【问题讨论】:

  • &lt;input type="submit" value="Submit"/&gt; 添加到您的代码中。
  • 我不能修改网页,因为它也在其他地方使用。

标签: html react-native webview


【解决方案1】:

由 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>.

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-02-25
    • 2018-09-19
    • 2011-10-14
    • 2016-06-24
    相关资源
    最近更新 更多