diff --git a/framework/res/xml/cordova.xml b/framework/res/xml/cordova.xml
index ddf30294..0ad5e5f8 100644
--- a/framework/res/xml/cordova.xml
+++ b/framework/res/xml/cordova.xml
@@ -30,7 +30,7 @@
-
+
diff --git a/framework/src/org/apache/cordova/CordovaWebView.java b/framework/src/org/apache/cordova/CordovaWebView.java
index 773f2b8b..d3e9e12b 100644
--- a/framework/src/org/apache/cordova/CordovaWebView.java
+++ b/framework/src/org/apache/cordova/CordovaWebView.java
@@ -47,6 +47,8 @@ public class CordovaWebView extends WebView {
String baseUrl;
private Stack urls = new Stack();
+ boolean useBrowserHistory = false;
+
protected int loadUrlTimeout;
protected long loadUrlTimeoutValue;
@@ -304,7 +306,8 @@ public class CordovaWebView extends WebView {
}
pluginManager.init();
- this.urls.push(url);
+ if(!useBrowserHistory)
+ this.urls.push(url);
}
}
@@ -315,7 +318,8 @@ public class CordovaWebView extends WebView {
public void loadUrl(final String url, final int time)
{
// If not first page of app, then load immediately
- if (this.urls.size() > 0) {
+ // Add support for browser history if we use it.
+ if (this.urls.size() > 0 || this.canGoBack()) {
this.loadUrl(url);
}
diff --git a/framework/src/org/apache/cordova/CordovaWebViewClient.java b/framework/src/org/apache/cordova/CordovaWebViewClient.java
index 7338ed21..e101c8b1 100755
--- a/framework/src/org/apache/cordova/CordovaWebViewClient.java
+++ b/framework/src/org/apache/cordova/CordovaWebViewClient.java
@@ -152,7 +152,11 @@ public class CordovaWebViewClient extends WebViewClient {
// If our app or file:, then load into a new Cordova webview container by starting a new instance of our activity.
// Our app continues to run. When BACK is pressed, our app is redisplayed.
if (url.startsWith("file://") || url.indexOf(appView.baseUrl) == 0 || appView.isUrlWhiteListed(url)) {
- appView.loadUrl(url);
+ //This will fix iFrames
+ if(appView.useBrowserHistory)
+ return false;
+ else
+ appView.loadUrl(url);
}
// If not our application, let default viewer handle
diff --git a/framework/src/org/apache/cordova/DroidGap.java b/framework/src/org/apache/cordova/DroidGap.java
index b084e5dc..21e14aa7 100755
--- a/framework/src/org/apache/cordova/DroidGap.java
+++ b/framework/src/org/apache/cordova/DroidGap.java
@@ -203,7 +203,10 @@ public class DroidGap extends Activity implements CordovaInterface {
// If true, then the JavaScript and native code continue to run in the background
// when another application (activity) is started.
protected boolean keepRunning = true;
-
+
+ // Store the useBrowserHistory preference until we actually need it.
+ private boolean useBrowserHistory = false;
+
// preferences read from cordova.xml
protected PreferenceSet preferences;
@@ -225,6 +228,8 @@ public class DroidGap extends Activity implements CordovaInterface {
if (preferences.prefMatches("fullscreen","true")) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
+ } else if(preferences.prefMatches("useBrowserHistory", "true")) {
+ useBrowserHistory = true;
} else {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
@@ -286,6 +291,7 @@ public class DroidGap extends Activity implements CordovaInterface {
// Add web view but make it invisible while loading URL
this.appView.setVisibility(View.INVISIBLE);
+ this.appView.useBrowserHistory = useBrowserHistory;
root.addView(this.appView);
setContentView(root);