Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to read a image file from the WWW directory phonegap (IOS)
    primarykey
    data
    text
    <p>Basicly I want to read/get an image file (jpg) from the /WWW/images/ directory in phonegap for IOS5/6 but I can't access to them.</p> <p>It's seems to be a simple task but I can't do It, it's frustrating</p> <p>This is programed into a virtual machine and is played from a simulator.</p> <p>this is my code. </p> <pre><code>function first(){ window.requestFileSystem(LocalFileSystem.PERSISTENT,0,gotFS,fail1); } function gotFS(fileSystem){ console.log("gotFS__"); fileSystem.root.getFile("images/faq.jpg",null,gotFileEntry,fail1); } function gotFileEntry(fileEntry){ console.log("gotFileEntry___"); fileEntry.file(gotFile,fail1); } function gotFile(file){ readDataUrl(file); } function readDataUrl(file){ console.log("readDataUrl___"); var reader = new Filereader(); reader.onloadend=function(evt){ console.log("read as data URL"); console.log("result:"+evt.target.result); } } reader.readAsDataURL(file); } function fail1(evt){ console.log(evt.target.error.code); } </code></pre> <p>there is no error report. but nothing happens where is my mistake? please help Me. best regards</p> <p><strong>SOLUTION</strong></p> <p>I found the solution, in my case I want to open a pdf file located in www/library/pdffiles/file.pdf.</p> <pre><code> var path = window.location.pathname; var phoneGapPath = path.substring(0,path.lastIndexOf('/')+1); var resource = phoneGapPath + "/pdffiles/"+ localFileName; window.plugins.childBrowser.showWebPage( resource ); </code></pre> <p>I hope someone will serve if they have the same problem.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload