phonegap / phonegap-plugin-contentsync

Download and cache remotely hosted content
Apache License 2.0
206 stars 98 forks source link

Browser compatible path #21

Open cfjedimaster opened 9 years ago

cfjedimaster commented 9 years ago

The docs for data.localPath say this, "However, it is guaraneteed to be a compatible reference in the browser."

Is that really true? data.localPath was a full path, /stuff/stuff/stuff, not a file:// path, so technically it isn't addressable by the browser.

imhotep commented 9 years ago

We were debating this not too long ago. I think we should use the file protocol as well just because it's directly useable by the File API if anything. The current path (with no file:// prefixed) should still work in the browser though…

cfjedimaster commented 9 years ago

Ah, to be fair, I didn't try to do use the value directly as an img src. When I saw the / path, I just assumed it wouldn't work.

On Wed, May 20, 2015 at 5:45 PM, Anis Kadri notifications@github.com wrote:

We were debating this not too long ago. I think we should use the file protocol as well just because it's directly useable by the File API if anything. The current path (with no file:// prefixed) should still work in the browser though…

— Reply to this email directly or view it on GitHub https://github.com/phonegap/phonegap-plugin-contentsync/issues/21#issuecomment-104064785 .

Raymond Camden, Developer Advocate for MobileFirst at IBM

Email : raymondcamden@gmail.com Blog : www.raymondcamden.com Twitter: raymondcamden

purplecabbage commented 9 years ago

file:// is not portable to all devices. Something like: cdvfile://localhost/persistent would make more sense. This seems more like a question than an issue ...

mwbrooks commented 9 years ago

Each platform should be free to use whatever path works best. There should be no guarantee that the same path will be used by all platforms, since each platform can store the assets in different places.

The only requirement is that the returned path can be correctly referenced in the web browser (as a linked URL, image source, etc).

revolunet commented 9 years ago

not sure if this will persist but we're using wkwebview plugin and thus we need to be able to convert the localPath to a http one from the local server too