Updated Branches: refs/heads/master 34840175f -> c206ac033
Fixing CB-1504 Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/commit/c206ac03 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/tree/c206ac03 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/diff/c206ac03 Branch: refs/heads/master Commit: c206ac03350b6eb8fe38d1c87503e288ed8c558f Parents: 3484017 Author: Joe Bowser <bows...@apache.org> Authored: Wed Sep 19 13:47:09 2012 -0700 Committer: Joe Bowser <bows...@apache.org> Committed: Wed Sep 19 13:47:09 2012 -0700 ---------------------------------------------------------------------- .../src/org/apache/cordova/CordovaWebView.java | 18 ++++++++++++++- 1 files changed, 17 insertions(+), 1 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/c206ac03/framework/src/org/apache/cordova/CordovaWebView.java ---------------------------------------------------------------------- diff --git a/framework/src/org/apache/cordova/CordovaWebView.java b/framework/src/org/apache/cordova/CordovaWebView.java index ddae1dd..9c05e44 100755 --- a/framework/src/org/apache/cordova/CordovaWebView.java +++ b/framework/src/org/apache/cordova/CordovaWebView.java @@ -50,6 +50,8 @@ import android.util.AttributeSet; import android.util.Log; import android.view.KeyEvent; import android.view.WindowManager; +import android.webkit.WebBackForwardList; +import android.webkit.WebHistoryItem; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebSettings.LayoutAlgorithm; @@ -572,12 +574,13 @@ public class CordovaWebView extends WebView { // Check webview first to see if there is a history // This is needed to support curPage#diffLink, since they are added to appView's history, but not our history url array (JQMobile behavior) if (super.canGoBack()) { + printBackForwardList(); super.goBack(); return true; } // If our managed history has prev url - if (this.urls.size() > 1) { + if (this.urls.size() > 1 && !this.useBrowserHistory) { this.urls.pop(); // Pop current url String url = this.urls.pop(); // Pop prev url that we want to load, since it will be added back by loadUrl() this.loadUrl(url); @@ -937,4 +940,17 @@ public class CordovaWebView extends WebView { settings.setAllowUniversalAccessFromFileURLs(true); } } + + + + public void printBackForwardList() { + WebBackForwardList currentList = this.copyBackForwardList(); + int currentSize = currentList.getSize(); + for(int i = 0; i < currentSize; ++i) + { + WebHistoryItem item = currentList.getItemAtIndex(i); + String url = item.getUrl(); + LOG.d(TAG, "The URL at index: " + Integer.toString(i) + "is " + url ); + } + } }