Search code examples
ioscordovachildbrowser

Open local pdf with Cordova in iOS


I've tried to open local PDFs stored in the Resources/Documents folder in my XCode project. The code I put in .js file is:

Cordova.exec("ChildBrowserCommand.showWebPage", "file://"+pdf );

Where pdf is the name of the file, which changes for every file. But ChildBrowser doesn't open it. How can I fix this?

Thanks!


Solution

  • I could solve by myself. The path needed to have three slashes so I wrote Cordova.exec("ChildBrowserCommand.showWebPage", "file:///www/Documents/"+pdf ); I think it works if the documents directory is under www folder.