4

I have a .html, .js, .css files on SDCARD, in my case html file contents are in encrypted form. I'm loading html file in following steps :

  1. Read file content
  2. Decrypt all content
  3. Load all content into webview using below line :

    webView.loadDataWithBaseURL(relativePath, decFileContent, "text/html", 
                    "utf-8", null );
    

    here relativePath = "file:///mnt/sdcard/MyFolder/"

What happens?

It loads the decrypted content successfully, however not loading js & css files kept in relativePath folders named with JS/ & CSS/ respectively. It gives the following error dialog

"Sorry! your application not support to local storageError: SECURITY_ERR: DOM Exception 18"

Also, I searched for the above error & possible similar links are 1 & 2 in answers to these questions they have suggested to load js & css from assets folder. In my case I don't want load them from assets, I want to load them from SDCARD. Anybody have an idea how to achieve this?

Community
  • 1
  • 1
sachin003
  • 8,983
  • 4
  • 21
  • 23
  • I'm accessing content and was having a bit of trouble with the relativePath and got it working from something similar to your relative path. – danny117 Sep 02 '14 at 20:08

1 Answers1

2

Give the entire path of the HTML file, not just the directory path in relativePath.

Or you can also use loadUrl

http://developer.android.com/reference/android/webkit/WebView.html#loadUrl%28java.lang.String%29

Sagar Waghmare
  • 4,702
  • 1
  • 19
  • 20