pasine
pasine

Reputation: 11543

PhoneGap: get back to index.html

I want to use an external service in my PhoneGap app for iPhone.
The service take a success url to redirect user to the original page when the process has been completed.
What url should I pass to the service to get back to my PhoneGap app?
I have tried with file://www/index.html, but I get permission error.

Upvotes: 1

Views: 622

Answers (1)

Tom Clarkson
Tom Clarkson

Reputation: 16174

You can't use absolute urls reliably in PhoneGap html pages. On android you have

file:///android_asset/www/index.html

but on iOS your url is something like

file:////var/mobile/Applications/[uuid]/[app name].app/www/index.html

You don't know that url in advance, so to get an absolute link to index.html you will need to get that url from document.location and either set it as the base url or save it for use in links.

Upvotes: 1

Related Questions