I'm working on a Worklight project that downloads a zip file, unpacks it, and stores the files in the specific documents directory of the platform (in iOS that's NSDocumentDirectory, on Android I'm using getFilesDir()). The file consists of one HTML file and several images, located in a sub directory (media). Downloading and unzipping works fine on both platforms. After the unzip process I'm loading the contents of the HTML file into an existing div (since this is a Worklight app, everything is in one HTML file).
Here things become complicated:
The image tag sources in the HTML file that I've downloaded are relative to the HTML file (e.g. 'media/myimage.jpg'). When I inject the HTML file into the Worklight HTML file (which is located in the App bundle/package), the base URL changes and the images can't be found anywhere. I fixed this by writing native functions that rewrite all the image tags in the downloaded HTML file to point to an absolute URL (iOS: /var/mobile/Applications/<identifier>/Documents/, Android: /data/data/<id>/files/). This works fine on iOS, but on Android it causes the HTML to only load partially. LogCat then shows:
Unknown chromium error: -6
If I keep the files as they are, the HTML loads correctly, but obviously with broken images. I've also tried to change the URLs to file:///data/data/<id>/files/ [...], which also causes the HTML to not load completely. I have really no idea what is causing this problem. The app already has the WRITE_EXTERNAL_STORAGE permission.
Does anyone have an idea how to fix this? Thank you!
Turns out this error was caused by having images that are larger than 1500px in width. After scaling them down, the error disappears. Must be a problem with the Android webview, I guess.
Related
Trying to load a local HTML file (SPA including assets, js, css) on Chrome on Android. File is loaded, html seems to be parsed but shows nothing.
When debugging this remotely (USB/adb) I got this error in the console:
Not allowed to load local resource: content://com.huawei.filemanager.share.fileprovider/root/storage/emulated/0/Download/test1/index.html
Basically it seems the file is not loaded at all.
What can be done ? Help, Tx.
i'm creating a simple html page using droidEdit in Android, simple as that.
In this page there's a div with a background.
This background is an image stored locally, but the url must be (for a number of reasons) an absolute path, not a relative one, and in particular one like this: file:///sdcard/assets/images/test.gif
Now, if i open my page opening Chrome and navigating to file:///sdcard/index.html everything works perfectly, and i can see my div with his nice animated background.
My problem is that if i instead open index.html directly from the file manager, Chrome is launched and it correctly display index.html but the div shows no background at all.
I'm not an expert in how Android system works underneath the surface, but since the same code (with a different file:/// path, of course) works in Windows, i suspect that Android somehow uses a different url/uri system to handle locally stored files.
Is there any way to set the right (absolute) path of test.gif to make the css load it correctly, when i open index.html directly from the file manager?
Thank You in advance
Accessing local images works when navigating directly to the file in chrome. It won't work when opening the html file from another page because of security rules imposed by browser. Checkout the full details here: https://blog.chromium.org/2008/12/security-in-depth-local-web-pages.html
It can be fixed by base64 encoding the image using any online tool(search for base64 image) and using the result as background:
body{
background: url('data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxMTEhUTExIVFhUXGRgYFxgXGBcXFhgXFxUXFxcXGBcYHSggGBolGxUXITEhJSkrLi4uFx8zODMtNygtLisBCgoKDg0OGxAQGy0lICYvLi0tLS0tLS0tLystLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLf/AABEIAKgBKwMBIgACEQEDEQH/xAAcAAACAgMBAQAAAAAAAAAAAAAEBQMGAQIHAAj/xAA9EAABAwMCAwYEBQIFAwUAAAABAAIRAwQhEjEFQVEGImFxgZETMqGxBxTB0fBCUiMzYuHxFUNyFmOCktL/xAAaAQADAQEBAQAAAAAAAAAAAAABAgMEAAUG/8QAKREAAgICAgICAQQCAwAAAAAAAAECEQMhEjEEQSJRExQyYXGR8HKBof/aAAwDAQACEQMRAD8Au/FHVGUsVDIiOhQ9tb136CcTzjMKwWFFjiS7J8dh5Iq5u2M3K+UrVl6NDZDSA4nA6qK34exuWAAjb/daXd4HNkGPul3DeLjLdQ579UV2c2kyG47Q6XvpvBkcx9lxTt8dVzqAwuj8fA+MXAyXZPhyVX4rw8VSJWrx8rxztkpSvsfdknup2w0TkYzv1RguaudVOAdvIblH9lLI6AGt7rBHmUz4rWptbpMSFKU2VXQtsezAc01XxnIB5DrnyUJsSDqacNMhWzgFdlW3E5wQ4cwobrhZbTOmDHvCpmg3BNdBpM27M8TBBa45lOa9IP32VU4LZvbJIMpm7iZaCPad0sPKfFQn0cl7BeN8KZ/TAJ5eKCPBXMEmCEtvOKVC8HJAPRWbhPFBWhrgNvqpynGbvo602V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3vHtf3st1AGBEdR5wZnmDPVeXkJPYr7G9ag0kBzAWkzMSBAAJPTrKDcxrXbnW505yG6+YI/wBQzO0Ly8pQ6s5m1pc99xP9paZzmM59UzuqTWuDWzJG+I1kAxPMwD4ZHkvLy5Aj0Am7FN0ZDW5EQC0jY9TucdQvVajS9xBDQcQNtpI25umMbALy8i36OZmnEanuJgNa2DAeWxOPDHsk12Q97nOOSZ6Y5fSFleQjti2f/9k=')
}
Or uploading the background image to any image hosting service and reference the url.
My Application has custom webviews loading html (react based webpack build) from local assets folder. When I tried to load the webview , I see the error
"Not allowed to load local resource : file:///android_asset/index.html/#/initialize?..."
Please note : the route ("index.html/#/..") added along with the html. If I load the html only, it works fine.
My application has permission to read and write from storage.
I cannot use loadDataWithBaseURL because the 2nd parameter expects a html data.
Sorry - it was a simple issue.
When using react route - the URL should be :
file:///android_asset/index.html#/initialize?...
and not file:///android_asset/index.html/#/initialize?...
Notice the extra '/' after the .html
I have the following really simple HTML - see below.
I have stored the HTML in a .html file on my PC and I have placed the PNG file in the same folder. When I open the HTML file, it works fine. However when I move the two files to my Android phone and execute the HTML file, the PNG file is not found (the not found icon is displayed). This happens with several browsers (including Chrome and Opera). This used to work. Any idea why I'm getting the error?
Has something changed recently? For example, when I open the above HTML file on my Android, I now see "content://" in the address line whereas I used to see "file://".
Many thanks
<BODY>
<IMG src="./1419196262_circle_close_delete-20.png">
</BODY>
I am developing an app on Android using Crosswalk that show files that I need to download from a web service. I would rather download the files to the external storage. But when I try to load them into the Crosswalk WebView I get a "Not allowed to load local resource:" error. I tried opening them directly and through a json manifest with csp properties like this (and some variations):
"csp" : "default-src 'self' file:// http:// https://"
My current setting are rather permissive:
mXWalkView.getSettings().setAllowContentAccess(true);
mXWalkView.getSettings().setAllowFileAccess(true);
mXWalkView.getSettings().setDomStorageEnabled(true);
mXWalkView.getSettings().setAllowFileAccessFromFileURLs(true);
mXWalkView.getSettings().setAllowUniversalAccessFromFileURLs(true);
mXWalkView.getSettings().setJavaScriptEnabled(true);
But still no success. Any ideas? Is this even possible?
UPDATE
To clarify and so that it doesn't get lost in the comments:
I am using the following code to load the file:
String url = "file:///storage/emulated/0/wh_files/index.html";
mXWalkView.load(url, null);
OK, I was finally able to track down the problem and it didn't have anything to do with the implementation. There seems to be a hardware problem on the device and the file that I wanted to load was corrupted.
I guess that the important lesson to learn is that the "Not allowed to load local resource:" error not always means what it says.