I am facing an issue with loading files from SDCARD onto a webview. The .html, .js, .css files are stored on the SDCARD in my scenario, and the html file content is encrypted. The steps I follow to load the html file are:
- Read file content
- Decrypt all content
Load all content into the webview using the following line:
webView.loadDataWithBaseURL(relativePath, decFileContent, "text/html", "utf-8", null );
where
relativePath = "file:///mnt/sdcard/MyFolder/"
What occurs?
The decrypted content loads successfully, but it does not load the js & css files located in folders named JS/ & CSS/ within the relativePath. An error dialog is displayed stating:
"Sorry! your application does not support local storageError: SECURITY_ERR: DOM Exception 18"
After researching the above error, I found some helpful links such as 1 & 2. The solutions provided in these answers suggest loading js & css files from the assets folder instead of the SDCARD. However, in my case, I want to load them from the SDCARD directly. Does anyone have any ideas on how to achieve this?