Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions framework/src/org/apache/cordova/engine/SystemWebViewEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Licensed to the Apache Software Foundation (ASF) under one
import android.os.Build;
import android.view.View;
import android.webkit.ValueCallback;
import android.webkit.WebBackForwardList;
import android.webkit.WebSettings;
import android.webkit.WebSettings.LayoutAlgorithm;
import android.webkit.WebView;
Expand Down Expand Up @@ -278,11 +279,20 @@ public boolean canGoBack() {
public boolean goBack() {
// Check webview first to see if there is a history
// This is needed to support curPage#diffLink, since they are added to parentEngine's history, but not our history url array (JQMobile behavior)
if (webView.canGoBack()) {
webView.goBack();
return true;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
WebBackForwardList list = webView.copyBackForwardList();
if (list.getCurrentIndex() > 0) {
parentWebView.sendJavascript("history.back();");
return true;
}
return false;
} else {
if (webView.canGoBack()) {
webView.goBack();
return true;
}
return false;
}
return false;
}

@Override
Expand Down