java - Manipulate the url a webview gets before it starts loading -
i add current location request variable url's loaded in webview can use information on page without reloads or requests.
i have webviewclient shouldoverrideurlloading doesn't receive requests when passed using loadurl. read it's possible intercept requested url using shouldinterceptrequest i'm on api level 8 , don't want change this.
is there way manipulate url before gets loaded webview?
yes, change url
before call loadurl
. can create 1 function modifies url
, call loadurl
, in shouldoverrideurlloading
public url addlocationtourl(url url) { url newurl = url; //do url return newurl; } loadurl(addlocationtourl(someurl)); //and in webviewclient @override public boolean shouldoverrideurlloading(webview view, string url) { mwebview.loadurl(addlocationtourl(someurl)); return true; }
Comments
Post a Comment