POST method with variables for WebView?

Hello! Is there a way to open WebView URL with POST method and variables?

Hi Matti,

Sort of. What do you want to do? It’s possible that you might just want to use the HTTP package, then load the returned HTML from your server into the webview.

I’d like to redirect the user to a certain page with POST variables attached. I didn’t find a method in the WebView, but I solved this by creating a basic FORM with automatic Javascript submit and pushing this to the WebView.

Hi Matti.

I find myself in the same situation

Could you show me how you solved it?

Thank you

Hello! The WebView has a LoadHtml method which enables to load an HTML string to the WebView and render it. So, I’m basically pushing a Form with JavaScript (to trigger the Form automatically) to the WebView. I don’t have the snippet at hand, but I can copy&paste it tomorrow.

var form = "<form action='' id='form' method='post'>";
form += "<input type='hidden' name='variable_1' value='value_1' />";
form += "<input type='hidden' name='variable_2' value='value_2' />";
form += "</form><script>document.getElementById('form').submit();</script>";

Thank you,

It’s just what I need, it works very well

Sorry for “Thread-Hijacking”:

Just wanted to leave a BIG THANK YOU!!!