I am working on an application where we are providing user with the option to navigate back to the webpages user has previously viewed.
The problem arises when user navigates back to a page which contained POST data.
I don't know how to detect that the page loaded in the WebView had POST data so that app can prompt a confirm dialog, if he wants to resend the POST data or not.
I have seen this happening in android browsers [Native browser & Skyfire]
Thanks in advance...
After several days of research I created a workaround to get rid of this situation.
I set a flag when WebView.goback()
is called.
In my onProgressChanged()
method I check if the url being loaded matches with the url which should contain the POST DATA, then I call WebView.reload()
, I set my flag to false and I also override the onFormResubmission
method of the WebViewClient
this way:
@Override
public void onFormResubmission (WebView view, Message dontResend,Message resend){
resend.sendToTarget();
}
For more detailed information, visit: http://mytechead.wordpress.com/2012/03/08/resubmit-post-data-in-a-webview/