forked from github/cordova-android
Optimize loading "about:blank"
This commit is contained in:
parent
f74d8aaf2b
commit
5c48ccd92a
13
framework/src/org/apache/cordova/CordovaWebView.java
Normal file → Executable file
13
framework/src/org/apache/cordova/CordovaWebView.java
Normal file → Executable file
@ -291,6 +291,11 @@ public class CordovaWebView extends WebView {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void loadUrl(String url) {
|
public void loadUrl(String url) {
|
||||||
|
if (url.equals("about:blank") || url.startsWith("javascript:")) {
|
||||||
|
this.loadUrlNow(url);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
String initUrl = this.getProperty("url", null);
|
String initUrl = this.getProperty("url", null);
|
||||||
|
|
||||||
// If first page of app, then set URL to load to be the one passed in
|
// 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);
|
this.loadUrlIntoView(initUrl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load the url into the webview after waiting for period of time.
|
* Load the url into the webview after waiting for period of time.
|
||||||
@ -329,7 +335,6 @@ public class CordovaWebView extends WebView {
|
|||||||
* @param url
|
* @param url
|
||||||
*/
|
*/
|
||||||
public void loadUrlIntoView(final String url) {
|
public void loadUrlIntoView(final String url) {
|
||||||
if (!url.startsWith("javascript:")) {
|
|
||||||
LOG.d(TAG, ">>> loadUrl(" + url + ")");
|
LOG.d(TAG, ">>> loadUrl(" + url + ")");
|
||||||
|
|
||||||
this.url = 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.
|
* Load URL in webview.
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user