2012-10-04 63 views
7

我试图在重定向到外部页面后回到我的应用程序。Cordova/Phonegap外部页面加载启动页面

我在同一个webview中查看www.external.com(查看设置OpenAllWhitelistURLsInWebView = YES)。 这不是白名单拒绝的问题,主机配置了外部主机plist设置。

的www.external.com包含简单:

<?php 
$url = urldecode($_GET['url']);  
header('Location: ' . $url); 
?> 

然后我要回来的index.html#我/路由 的问题是主要的PhoneGap页面的绝对路径:

file:///var/mobile/Applications/48D1C223-FD34-436E-85BE-8C0B58859ECF/MyApp.app/www/index.html#my/route/ 

我也得到(无论是在模拟器或设备)安全性错误:

Failed to load webpage with error: You do not have permission to access the requested resource. 

我无法使用window.history.back(),因为我重定向了多次。 顺便说一下,window.history.back()正在工作,我回到我的应用程序。

我在xCode 4.5上使用了cordova 2.1。

在此先感谢!

+0

你有没有想过呢?我遇到了完全相同的情况,并没有找到有关处理它的很多信息。 – speby

+0

我今天就在这里... #crossfingers – SuperSkunk

+0

三年后 - 有没有人有解决这个问题? – zyzof

回答

1

这是我创建cordova-plugin-startpage的部分原因。

调用startpage.loadContentSrc()插件方法,它应该将您重定向回来。