I would like to add the current location as a request variable to URL\'s loaded in the webview so I can use this information on the page without reloads or extra requests.>
Yes, change the Url
before you call for loadUrl
. You can create one function which modifies the Url
and call it for loadUrl
and in shouldOverrideUrlLoading
public Url addLocationToUrl(Url url) {
Url newUrl = url;
//do something with url
return newUrl;
}
loadUrl(addLocationToUrl(someUrl));
//and in your WebViewClient
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
mWebView.loadUrl(addLocationToUrl(someUrl));
return true;
}