-2

In my app a webpage is loaded in a webview. With shouldOverrideUrlLoading() I can open links on that page in the same webview. But is there a way to append on all links a parameter like &mode=app every time when this specific url is loaded? All urls with e.g. example.com should look like example.com?mode=app and all other urls should stay how they are.

Is this possible?

Tavo
  • 2,907
  • 4
  • 27
  • 44
user3107651
  • 9
  • 1
  • 3
  • I think this should answer your question http://stackoverflow.com/questions/4066438/android-webview-how-to-handle-redirects-in-app-instead-of-opening-a-browser – simeon iliev Sep 11 '15 at 14:19

1 Answers1

4

in your method you can try it.

@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
    if (url.equals("example.com") || url.equals("http://example.com")) {
        url = url + "?mode=app";
    }
    view.loadUrl(url);
    return true;
}
Sergey Glotov
  • 19,939
  • 11
  • 82
  • 96
SRB Bans
  • 3,056
  • 1
  • 8
  • 20