Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions framework/src/org/apache/cordova/ConfigXmlParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,14 @@ public ArrayList<PluginEntry> getPluginEntries() {
}

public String getLaunchUrl() {
if (launchUrl == null) {
if (launchUrl == null) {
Comment thread
NiklasMerz marked this conversation as resolved.
launchUrl = "https://" + this.prefs.getString("hostname", "localhost");
}

if (this.prefs.getBoolean("AndroidInsecureFileModeEnabled", false)) {
launchUrl = "file:///android_asset/www/index.html";
}

return launchUrl;
}

Expand Down Expand Up @@ -142,7 +147,11 @@ private void setStartUrl(String src) {
if (src.charAt(0) == '/') {
src = src.substring(1);
}
launchUrl = "https://" + this.prefs.getString("hostname", "localhost") + "/" + src;
if (this.prefs.getBoolean("AndroidInsecureFileModeEnabled", false)) {
launchUrl = "file:///android_asset/www/" + src;
} else {
launchUrl = "https://" + this.prefs.getString("hostname", "localhost") + "/" + src;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,14 @@ private void initWebViewSettings() {
settings.setSaveFormData(false);
settings.setSavePassword(false);

if (preferences.getBoolean("AndroidInsecureFileModeEnabled", false)) {
//These settings are deprecated and loading content via file:// URLs is generally discouraged,
//but we allow this for compatibility reasons
LOG.d(TAG, "Enabled insecure file access");
settings.setAllowFileAccess(true);
settings.setAllowUniversalAccessFromFileURLs(true);
}

settings.setMediaPlaybackRequiresUserGesture(false);

// Enable database
Expand Down