Skip to content

Commit

Permalink
add backwards compatibility mode for WebViewAssetLoader
Browse files Browse the repository at this point in the history
  • Loading branch information
NiklasMerz committed Apr 28, 2021
1 parent f9e8ce8 commit 7ff9638
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
7 changes: 6 additions & 1 deletion 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) {
launchUrl = "https://" + this.prefs.getString("hostname", "localhost");
}

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

return launchUrl;
}

Expand Down
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("InsecureFileMode", 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

0 comments on commit 7ff9638

Please sign in to comment.