Languages

Menu
Sites
Language
FileEntry.toURL() not working - or the tizen browser not capable of filesyste:file://Persistent

If I download a html file onto the persitence service it is not loadable into the webapp browser. This does neither work with entry.fullPath nor with entry.toURL(), which return the same value, entry being a html5 FileEntry.

The location presented is something like

filesystem:file:///Persistent/file.html

Cutting off filesyste: and make it file:///Persistent/file.html does not work, unsurprisingly. Any ideas?

I tried both the default browser of the webapp and an iframe. Neither works.

Edited by: Thomas Uher on 20 Oct, 2013

Responses

5 Replies
Lakshmi Grandhi

Hi,

 

Please check whether you are able to download file on persistant storage.

Thomas Uher

I am. I downloaded the file onto the persistant storage. I also checked the file contents by reading it with the html5  FileReader (readAsText method) after downloading, so the file's contents are valid. I also can link to downladed files (images) in <img> tags, and the images are shown correctly. As soon as I try to display a downloaded html file, this does not work. This feature is crucial for me as I have an implemented offline functionality for wikipedia pages (this already works on other platforms, and as I get the pages from my own server I know that the html itself does work).

Lakshmi Grandhi

Try opening the file using  window.open("Wikipedia, the free encyclopedia.html", "_self");

Thomas Uher

Thank you for your answer. I think we are getting closer. I stripped off 'filesystem:file:///Persistent/' from the toURL() result and the browser at least understood the address, which resulted in:

file:///opt/usr/apps/ZvrzJxri42/res/wgt/offlineWiki/en.m.wikipedia.org/wiki/Birch.html

It says "Webpage temprarily not available", which I think indicates the 404 not found error.

I also checked if I can read the file through the html5 filereader the following way:

window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, errorHandler);
fileSys.root.getDirectory(...) -  directoryEntry.getDirectory() , travel the path to the folder 'wiki'
directory.getFile('Birch.html')
reader.readAsText(FileEntry)

which displays the contents of the html file correctly. I have to add that I did it this way because window.resolveLocalFilesystemURI / window.resolveLocalFilesystemURL did not work (neither if prefixed with webkit). I think this did not work because of the same reason as window.open() does not work: toURL() returning a path that is not understood by the system. Unfotunately, toURL() always gives me the same thing as .fullPath.

Summary: the file is somewhere, but how do I get a path that works with the browser?

Thomas Uher

Just for the record:

I now tried to do it without subfolders and open it with:

window.open("Birch.html", "_self");

with the same result. The file can be opened with the filereader, but not with the browser.