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 2022/02/23 06:30:14 UTC

[GitHub] [cordova-plugin-file] pietos edited a comment on issue #512: Cordova 10 Android Template Serves via Https so cvdfile: webview access also no longer works here

pietos edited a comment on issue #512:
URL: https://github.com/apache/cordova-plugin-file/issues/512#issuecomment-1048483440


   I had a similar issue as a workaround I load the files into a blob and then attach the blob to the html view.
   First I only had to do this for IOS devices, but since the latest cordova and android updates I use the IOS condition for both Android and IOS.
   
   **Example code**
   
   `// remark: rs.rows.item(0).localsrc; the store result of fileEntry.toInternalURL();
   rs.rows.item(0).localsrc; (which is fileEntry.toInternalURL();)
   
   // On IOS we have to convert the image to a blob
   window.resolveLocalFileSystemURL(rs.rows.item(0).localsrc, function(fileEntry) {
     if (window.cordova.platformId == "ios") {
     fileEntry.file(function(file) {
         var reader = new FileReader();
         reader.onloadend = function() {
             if (reader.result) {
                 var blob = new Blob([new Uint8Array(reader.result)], { type: "image/jpeg" });
                 blob = window.URL.createObjectURL(blob);
                 companylogoimgEL.src = blob;
             } else {
                 companylogoimgEL.src = 'res/' + APP_SELLER + '/logo_horizontal_white_smaller.png';
             }
         };
         reader.readAsArrayBuffer(file);
     });
     // On Android we can just load the local file
     } else {
         companylogoimgEL.src = rs.rows.item(0).localsrc;
     }
   }`


-- 
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