How to set a Referer on an android WebView - android

Is it possible to set the HTTP referer or HTTP header data generally in a WebView?
I know there is a method loadUrl(String url, Map<String, String> additionalHttpHeaders)
How to send a referer request in a url for a webView
But the headers are only sent for the given URL.
I need to set headers for every request that is sent via JavaScript from within the WebView.
I Have try to open the webapplication within mobile application..
Does somebody know a solution?

Related

Android intercept the response body and headers from a WebView?

I need to intercept the responses coming back from the response and redirects of a webview as it's loading?
I need to read the headers during the redirect, and I need to read cookies coming back.
Is this possible? Looking at some samples on stackoverflow, most solutions use shouldOverrideUrlLoading but that only gives you access to the url, and not the full response

Android WebView ajax request interception

I would like to intercept ajax call from WebView, add extra data to the url, and continue with the request as usual:
For example: change http://localhost:5000/doSomething to
http://localhost:5000/doSomething?secret=my_secret
and then pass the request for the web server.
I didn't succeeded doing that with shouldInterceptRequest

How to read the XMLHTTP request body in android

I am working with the web views in android, XMLHTTP requests are sending to the server from my application in the web view, how can i read the HTTP post request body
There are no WebViewClient/WebChromeClient callbacks for this (the closest is shouldInterceptRequest but that only gives you a URL). If the JavaScript is yours use addJavaScriptInterface to pass the request body to the Java code.

How to send a HTTP POST request with a cookie attached in WebView?

I am using WebView in Android. My ASP.NET Server set a cookie in WebView which is used to track user. Every thing works fine. Now I need to send an explicit HTTP POST request to server with the same cookie. Is it possible?

Android get request and response objects from webview

is there a way to get request and response objects from a webview?
for requests made from some webpage running in my webview, i want to intercept the full http request object(the headers, http method used, http body etc) and divert and send across that request into another channel.
For responses received from the webview, i want to do the same and get the object and its properties.
So far i have looked at the webviewClient android class which allows you to intercept url links executed by a webpage and intercept the resources it loads.
However, what i want to intercept, is any actual http requests the webpage makes. is this possible in Android webview?
thanks
That is not directly possible. You are welcome to write an HTTP proxy, then attempt to get WebView to work with that (e.g., see if it supports the http.proxyHost and http.proxyPort system properties).

Categories

Resources