android hidden webview, Is it possible?
I want to build an application which takes user/pass information from user and use it on an https webpage and extract the returned raw html code from that page.
I want to know is this possible?
If so, what sort of class i should use. Can it be done with some hidden webview mechanism. Sine i think we can access the java script variable in a webview from our application. So is this possible. Or i am just wasting my time in t开发者_如何学Gohis direction.
If you are asking if it is possible to 'download' a webpage without actually displaying it in a WebView then try this...
HttpClient client=new DefaultHttpClient();
HttpGet getMethod = new HttpGet(Url);
ResponseHandler<String> responseHandler=new BasicResponseHandler();
String response = client.execute(getMethod, responseHandler);
EDIT: Sorry - the Url parameter passed to HttpGet() above is actually a String variable containing a url to the wep page you want.
Pretty old subject here, but I see that I'm not the only one facing this situation.
This is how I understand it:
HttpClient objects and WebView objects will not share the same "session" scope through your application. That is, if you have this URL that performs authentication and starts a valid session on a website; and following that, you try to open one of those website pages - session protected - through the webview, the webview will act as if no session were available. WebView is not aware of the HttpClient session.
A solution to that is to call the URL that starts a session through the WebView.postUrl method like this:
webView.postUrl(url, EncodingUtils.getBytes(postParameters, "BASE64"));
I'm sure this can be done in a hidden webView.
精彩评论