How to load www folder(html files) from internal storage to BBDCordovaWebview?

370 Views Asked by At

I have a file named index.html in assets folder. We are reading this file and writing it to BBD Secure storage using File class wrapper(FileOutputStream) provided by BBD.

Code for writing it to BBD secure storage,

com.good.gd.file.FileOutputStream("index.html").apply {
            write(inputStream.readBytes())
            close()
        }

This is encrypting the file content and storing it inside app_data folder also the file name is encrypted by BBD secure storage.

We read the stored file as follows,

loadUrl(GDFileSystem.getAbsoluteEncryptedPath("index.html"))

The above code is able to locate the encrypted file which was stored earlier and when we tried to load this in BBDCordovaWebView we get net::ERR_ACCESS_DENIED

1

There are 1 best solutions below

12
MSohm On

BBDCordovaWebView does not support the loading of local files using file:///..., so it is not possible using that method.

But you could load and read the file using the cordova-plugin-bbd-file API.

  1. Create the file using cordova-plugin-bbd-file API.
  2. Write HTML content to it using same plugin when app loads.
  3. Read this file at some point using same plugin.
  4. Update the DOM using file content.