mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-26 12:03:28 +08:00
Fixing CB-1504
This commit is contained in:
parent
34840175f3
commit
c206ac0335
@ -50,6 +50,8 @@ import android.util.AttributeSet;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
|
import android.webkit.WebBackForwardList;
|
||||||
|
import android.webkit.WebHistoryItem;
|
||||||
import android.webkit.WebSettings;
|
import android.webkit.WebSettings;
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
import android.webkit.WebSettings.LayoutAlgorithm;
|
import android.webkit.WebSettings.LayoutAlgorithm;
|
||||||
@ -572,12 +574,13 @@ public class CordovaWebView extends WebView {
|
|||||||
// Check webview first to see if there is a history
|
// 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)
|
// 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()) {
|
if (super.canGoBack()) {
|
||||||
|
printBackForwardList();
|
||||||
super.goBack();
|
super.goBack();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If our managed history has prev url
|
// 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
|
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()
|
String url = this.urls.pop(); // Pop prev url that we want to load, since it will be added back by loadUrl()
|
||||||
this.loadUrl(url);
|
this.loadUrl(url);
|
||||||
@ -937,4 +940,17 @@ public class CordovaWebView extends WebView {
|
|||||||
settings.setAllowUniversalAccessFromFileURLs(true);
|
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 );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user