diff --git a/framework/src/org/apache/cordova/CordovaChromeClient.java b/framework/src/org/apache/cordova/CordovaChromeClient.java index e6507811..fb6d45f7 100755 --- a/framework/src/org/apache/cordova/CordovaChromeClient.java +++ b/framework/src/org/apache/cordova/CordovaChromeClient.java @@ -205,7 +205,7 @@ public class CordovaChromeClient extends WebChromeClient { // Security check to make sure any requests are coming from the page initially // loaded in webview and not another loaded in an iframe. boolean reqOk = false; - if (url.startsWith("file://") || url.indexOf(this.appView.baseUrl) == 0 || Config.isUrlWhiteListed(url)) { + if (url.startsWith("file://") || Config.isUrlWhiteListed(url)) { reqOk = true; } diff --git a/framework/src/org/apache/cordova/CordovaWebView.java b/framework/src/org/apache/cordova/CordovaWebView.java index e61a215e..e653a95c 100755 --- a/framework/src/org/apache/cordova/CordovaWebView.java +++ b/framework/src/org/apache/cordova/CordovaWebView.java @@ -76,7 +76,6 @@ public class CordovaWebView extends WebView { private CordovaChromeClient chromeClient; private String url; - String baseUrl; // Flag to track that a loadUrl timeout occurred int loadUrlTimeout = 0; @@ -208,7 +207,8 @@ public class CordovaWebView extends WebView { private void initWebViewClient(CordovaInterface cordova) { - if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB) + if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB || + android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) { this.setWebViewClient(new CordovaWebViewClient(this.cordova, this)); } @@ -405,17 +405,8 @@ public class CordovaWebView extends WebView { LOG.d(TAG, ">>> loadUrl(" + url + ")"); this.url = url; - if (this.baseUrl == null) { - int i = url.lastIndexOf('/'); - if (i > 0) { - this.baseUrl = url.substring(0, i + 1); - } - else { - this.baseUrl = this.url + "/"; - } + this.pluginManager.init(); - this.pluginManager.init(); - } // Create a timeout timer for loadUrl final CordovaWebView me = this; @@ -470,7 +461,7 @@ public class CordovaWebView extends WebView { if (LOG.isLoggable(LOG.DEBUG) && !url.startsWith("javascript:")) { LOG.d(TAG, ">>> loadUrlNow()"); } - if (url.startsWith("file://") || url.indexOf(this.baseUrl) == 0 || url.startsWith("javascript:") || Config.isUrlWhiteListed(url)) { + if (url.startsWith("file://") || url.startsWith("javascript:") || Config.isUrlWhiteListed(url)) { super.loadUrl(url); } } @@ -576,7 +567,7 @@ public class CordovaWebView extends WebView { if (!openExternal) { // Make sure url is in whitelist - if (url.startsWith("file://") || url.indexOf(this.baseUrl) == 0 || Config.isUrlWhiteListed(url)) { + if (url.startsWith("file://") || Config.isUrlWhiteListed(url)) { // TODO: What about params? // Load new URL this.loadUrl(url); diff --git a/framework/src/org/apache/cordova/CordovaWebViewClient.java b/framework/src/org/apache/cordova/CordovaWebViewClient.java index b937d98d..4751fc3b 100755 --- a/framework/src/org/apache/cordova/CordovaWebViewClient.java +++ b/framework/src/org/apache/cordova/CordovaWebViewClient.java @@ -194,7 +194,7 @@ 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.startsWith("data:") || url.indexOf(this.appView.baseUrl) == 0 || Config.isUrlWhiteListed(url)) { + if (url.startsWith("file://") || url.startsWith("data:") || Config.isUrlWhiteListed(url)) { return false; }