Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cordova/Phonegap external page load start page

Tags:

cordova

I'm trying to come back to my application after redirecting to an external page.

I'm loading www.external.com in the same webview (view the setting OpenAllWhitelistURLsInWebView = YES). It's not an issue with the whitelist rejection, the host is configured with the external hosts plist setting.

The www.external.com contain a simple :

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

And then I want to come back to index.html#my/route The problem is that the absolute path of the main phonegap page is :

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

And I get (either on Simulator or on device) a security error:

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

I can't use window.history.back() because I redirect more than one time. By the way, the window.history.back() is working, I come back to my app.

I'm using cordova 2.1 on xCode 4.5.

Thanks in advance!

like image 927
SuperSkunk Avatar asked Oct 04 '12 10:10

SuperSkunk


1 Answers

This is part of the reason I created cordova-plugin-startpage.

Call the startpage.loadContentSrc() plugin method and it should redirect you back.

like image 168
Alon Amir Avatar answered Sep 27 '22 19:09

Alon Amir