Android Browser supports javascript viewing, for example, the following code can launch the Browser application to display a warning dialog:
String finalUrl = "javascript:alert('hello')"; Intent browserIntent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(finalUrl)); startActivity(browserIntent);
The common trick jQuery does after the operation is that you create a javascript form and then submit it. Therefore, in theory, code similar to the one below should work (part of the code was copied from this message ):
//String finalUrl = "http://localhost:7001/display/result.jsp?param=12345"; String finalUrl = "javascript:" + "var to = 'http://localhost:7001/display/result.jsp';" + "var p = {param:'12345',param2:'blablabla',param3:'whatever'};"+ "var myForm = document.createElement('form');" + "myForm.method='post' ;" + "myForm.action = to;" + "for (var k in p) {" + "var myInput = document.createElement('input') ;" + "myInput.setAttribute('type', 'text');" + "myInput.setAttribute('name', k) ;" + "myInput.setAttribute('value', p[k]);" + "myForm.appendChild(myInput) ;" + "}" + "document.body.appendChild(myForm) ;" + "myForm.submit() ;" + "document.body.removeChild(myForm) ;"; Intent browserIntent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(finalUrl)); startActivity(browserIntent);
source share