mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-22 00:32:55 +08:00
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
|
||||
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.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user