You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2021/09/06 10:55:28 UTC

[GitHub] [cordova-android] erisu commented on issue #1316: Failed to load assets image with Version > 10

erisu commented on issue #1316:
URL: https://github.com/apache/cordova-android/issues/1316#issuecomment-913553082


   Cordova Android 10.x by default will use scheme+hostname. And Cordova-iOS 6.x I believe will always use scheme+hostname.
   
   The scheme can not match exactly because of limitations between each platform but the following example should work.
   
   But needs to be tested as I do not use this plugin.
   
   **Setup**:
   
   Let’s say you have an image uploaded at this directory path.
   
   `<project-root>/www/assets/image.png`
   
   **WebView Paths**:
   
   With Cordova iOS 6.x default settings, the path would be: `app://localhost/assets/image.png`.
   
   With Cordova Android 10.x and default settings, the path would be: `https://localhost/assets/image.png`
   
   **Recommendation**:
   
   Would be recommended to pass in the absolute path, `/assets/image.png`.
   
   You might also be able to use `//localhost/assets/image.png`. With this pattern is should automatically detect the scheme but the hostname setting must be identical.
   
   **Catches**:
   
   Now, not everyone can use the **https** protocol because they might load external third party resources or api requests to the **http** scheme and these can’t mix. At least **https**, a secure protocol can not call and insecure protocol. If you are faced with this issue, in case of Android, you can change the scheme to **http**.
   
   Now for the `AndroidInsecureFileModeEnabled` setting… This preference is for people who want to revert to the **file** protocol which 9.x and earlier used. It’s not recommended to serve from the file protocol as there can be security concerns. But depending on how the app is written and if the third party scripts is coming from a trusted source, and you know everything that is executed, then maybe it’s less of a problem.
   
   **First try the above recommendation:**
   Remove the `.` and make your path absolute, with default android and iOS settings for scheme+hostname, and see how that turns out.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org