Delete/Erase a particular url from Android web view history?
Well, not sure if you actually can play around with the back forward list. I would assume it's a copy - at least that's what the name suggest.
However, you can manipulate the back stepping to some degree. In my case I exit the application already when user tries to step back from second page towards first page.
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
int action = event.getAction();
int keyCode = event.getKeyCode();
switch (keyCode) {
case KeyEvent.KEYCODE_BACK:
if ((action == KeyEvent.ACTION_DOWN) && myWebView.canGoBack() ) {
WebBackForwardList list = myWebView.copyBackForwardList();
String lastUrl = list.getItemAtIndex(list.getCurrentIndex()-1).getUrl().toString();
// Exit if index == 1, i.e. currently on 2nd page
if (list.getCurrentIndex() == 1) {
finish();
} else ...
You could step over also other other pages by combining stuff from above and overloading url loading:
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url){
view.loadUrl(url);
return true;
}