PhoneGap:回到index.html

时间:2012-11-29 00:27:08

标签: iphone url cordova back

我想在iPhone的PhoneGap应用程序中使用外部服务 该流程完成后,该服务会成功将用户重定向到原始页面 我应该将什么网址传递回服务以回到我的PhoneGap应用程序? 我尝试使用file://www/index.html,但我得到了权限错误。

1 个答案:

答案 0 :(得分:1)

您无法在PhoneGap html网页中可靠地使用绝对网址。在Android上你有

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

但在iOS上你的网址就像是

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

您事先并不知道该网址,因此要获得index.html的绝对链接,您需要从document.location获取该网址,并将其设置为基本网址或将其保存以用于链接。