Search code examples
androidwebkitandroid-webviewbrowser-history

Get last loaded url of webview without doing a webView.goBack() in Android


I want to log the history url or last loaded url without manually storing the history urls. Is that possible?


Solution

  • Found the answer in the docs ...

    WebBackForwardList mWebBackForwardList = mWebView.copyBackForwardList();
    String historyUrl = mWebBackForwardList.getItemAtIndex(mWebBackForwardList.getCurrentIndex()-1).getUrl();