Jsoon
Jsoon

Reputation: 153

WebView for Flutter -How Allow the POST of data on initial URL?

how to display webview using parameters. here I have successfully displayed the webview but the token that I entered into the html code value is not readable, how can I enter the token into the html code value? what is the correct way?

UI

 _buildWebView(String token){
    return WebviewScaffold(
      withJavascript: true,
      appCacheEnabled: true,
      url: new Uri.dataFromString(_loadHTML(token), mimeType: 'text/html').toString(),
    );
  }

  String _loadHTML(String token) {
    return r'''
      <html>
        <body onload="document.f.submit();">
          <form id="f" name="f" method="post" action="https://payment/rrr">
            <input type="hidden" name="Massage" value=$token/>
          </form>
        </body>
      </html>
    ''';
  }

Upvotes: 0

Views: 1630

Answers (1)

aalthawadi
aalthawadi

Reputation: 31

this might work

  String _loadHTML(String token) {
return r'''
  <html>
    <body onload="document.f.submit();">
      <form id="f" name="f" method="post" action="https://payment/rrr">
        <input type="hidden" name="Massage" value='''+token+''''/>
      </form>
    </body>
  </html>
'''; }

Upvotes: 1

Related Questions