Android WebView canGoBack () returns false when url is similar

I have an Android web view that I want it to go back with the Android button. I work if the previous site, for example, https://www.aaa.com/index.phpand https://www.aaa.com/index2.php, but canGoBack () returns false when the URLs, for example, https://www.aaa.com/index.php?page=page1and https://www.aaa.com/index.php?page=page2. I think this is probably because the URLs are the same, they are just variables at the end that change. This is my code:

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (event.getAction() == KeyEvent.ACTION_DOWN) {
        switch (keyCode) {
            case KeyEvent.KEYCODE_BACK:
                if (view.canGoBack()) {
                    view.goBack();
                } else {
                    finish();
                }
                return true;
        }

    }
    return super.onKeyDown(keyCode, event);
}

How can I make it return even if the variable has changed to a URL?

+4
source share
1 answer

You probably got a bug in Chrome version 63. See: https://bugs.chromium.org/p/chromium/issues/detail?id=794020

0
source

Source: https://habr.com/ru/post/1691078/


All Articles