File tree Expand file tree Collapse file tree
framework/src/org/apache/cordova Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,9 +46,14 @@ public ArrayList<PluginEntry> getPluginEntries() {
4646 }
4747
4848 public String getLaunchUrl () {
49- if (launchUrl == null ) {
49+ if (launchUrl == null ) {
5050 launchUrl = "https://" + this .prefs .getString ("hostname" , "localhost" );
5151 }
52+
53+ if (this .prefs .getBoolean ("AndroidInsecureFileModeEnabled" , false )) {
54+ launchUrl = "file:///android_asset/www/index.html" ;
55+ }
56+
5257 return launchUrl ;
5358 }
5459
@@ -142,7 +147,11 @@ private void setStartUrl(String src) {
142147 if (src .charAt (0 ) == '/' ) {
143148 src = src .substring (1 );
144149 }
145- launchUrl = "https://" + this .prefs .getString ("hostname" , "localhost" ) + "/" + src ;
150+ if (this .prefs .getBoolean ("AndroidInsecureFileModeEnabled" , false )) {
151+ launchUrl = "file:///android_asset/www/" + src ;
152+ } else {
153+ launchUrl = "https://" + this .prefs .getString ("hostname" , "localhost" ) + "/" + src ;
154+ }
146155 }
147156 }
148157}
Original file line number Diff line number Diff line change @@ -159,6 +159,14 @@ private void initWebViewSettings() {
159159 settings .setSaveFormData (false );
160160 settings .setSavePassword (false );
161161
162+ if (preferences .getBoolean ("AndroidInsecureFileModeEnabled" , false )) {
163+ //These settings are deprecated and loading content via file:// URLs is generally discouraged,
164+ //but we allow this for compatibility reasons
165+ LOG .d (TAG , "Enabled insecure file access" );
166+ settings .setAllowFileAccess (true );
167+ settings .setAllowUniversalAccessFromFileURLs (true );
168+ }
169+
162170 settings .setMediaPlaybackRequiresUserGesture (false );
163171
164172 // Enable database
You can’t perform that action at this time.
0 commit comments