is it possible to load an external index.html (with included cordova.js) instead of the local one?
i found in the appdelegate.m this code:
self.viewController.wwwFolderName = @"www";
self.viewController.startPage = @"index.html";
i tried to reference an external url but without luck... anyone know a solution for this?
p.s.
with android it's easy:
super.loadUrl("http://192.168.1.135:3000/");
The simplest way I did is, xxxViewController: CDVViewController<...>
so,that is all.
For iOS it would be:
The names are confusing because the startPage is also the URL.
I have done this for my project (AppDelegate.m):
As mentioned elsewhere, the site you are trying access has to be whitelisted.
It's working nicely. My external site is on local IIS and has the cordova.js as well as few plugins. Now just have to see if I get Apple to approve my app!
Setting the wwwFolderName to empty string did not work for me but nil worked.
The simplest way I did is, include following script block in an index.html file and remove other code if not required:
And include the host in the
ExternalHosts
map inPhoneGap.plist
file, also checkOpenAllWhitelistURLsInWebView
is set toYES
in plist fileIf you include the PhoneGap source as a subproject (I used 1.7 and the directions still worked, see my note at the end), you can add a few lines of code to allow PhoneGap to support external URLs as the
startPage
.Around line 133, you'll want to add
right before
if (startFilePath == nil) {
By default, PhoneGap doesn't seem to support external startPage URLs without a javascript 'hack' mentioned above. Other than this (and that), I know no other way!
Let me know if you have more questions.
Note: as I mentioned above, the walkthrough is missing one step. I commented on the article to let the author know, but it hasn't been approved yet. Below is my comment: