如何在android webview中拦截POST数据 [英] How to intercept POST data in an android webview
问题描述
我有一个包含 webview 的 android 应用程序.它需要允许用户在网页上填写表单,然后在用户点击表单上的submit
后更改表单的数据.该表单将使用 POST 请求方法.
I have an android app that consists of a webview. It needs to allow users to fill in a form on a webpage and then change the data of the form after the user has clicked submit
on the form. The form will use the POST request method.
所以我的问题是,如何从表单中截取 POST 数据,更改其值,然后将其发送?
例如:如果有这样的网络表单...
For example: If there's a web form like this...
<form action="http://www.example.com/do.php" method="post">
<input type="text" name="name" />
<input type="text" name="email" />
<input type="submit" />
</form>
如果用户在表单中输入 name = Steve 和 email = steve@steve.com,我想在 android 应用程序中将值更改为 name = bob 和 email = bob@bob.com 并将新的 POST 设为发送到 http://www.example.com/do.php
.
If the user enters name = Steve and email = steve@steve.com in the form, I want to change the values to name = bob and email = bob@bob.com in the android app and have the new POST be sent to http://www.example.com/do.php
.
感谢您的帮助!
推荐答案
如果你熟悉 JavaScript,我建议你使用 JavaScript.我认为它更方便和容易.本导览将告诉您如何在 WebView 中使用 JavaScript.
If you are familiar with JavaScript, I would suggest you use JavaScript. I think it's more convenient and easy. This tour tells you how to use JavaScript in a WebView.
这篇关于如何在android webview中拦截POST数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!