Optimize loading "about:blank"

This commit is contained in:
Bryce Curtis 2012-05-16 23:27:19 -05:00
parent f74d8aaf2b
commit 5c48ccd92a

13
framework/src/org/apache/cordova/CordovaWebView.java Normal file → Executable file
View File

@ -291,6 +291,11 @@ public class CordovaWebView extends WebView {
*/
@Override
public void loadUrl(String url) {
if (url.equals("about:blank") || url.startsWith("javascript:")) {
this.loadUrlNow(url);
}
else {
String initUrl = this.getProperty("url", null);
// If first page of app, then set URL to load to be the one passed in
@ -302,6 +307,7 @@ public class CordovaWebView extends WebView {
this.loadUrlIntoView(initUrl);
}
}
}
/**
* Load the url into the webview after waiting for period of time.
@ -329,7 +335,6 @@ public class CordovaWebView extends WebView {
* @param url
*/
public void loadUrlIntoView(final String url) {
if (!url.startsWith("javascript:")) {
LOG.d(TAG, ">>> loadUrl(" + url + ")");
this.url = url;
@ -393,12 +398,6 @@ public class CordovaWebView extends WebView {
});
}
// If Javascript, then just load it now
else {
super.loadUrl(url);
}
}
/**
* Load URL in webview.
*