Reputation: 301
I created a new Cordova project and put my URL in AppDelegate.m:
// Set your app's start page by setting the <content src='foo.html' /> tag in config.xml.
// If necessary, uncomment the line below to override it.
self.viewController.startPage = @"http://mySite/";
When I launch the app in the Simulator, it launches and then opens my url in safari instead of in the app.
Why does it happen?
Thanks :)
Upvotes: 1
Views: 1137
Reputation: 301
What I missed was to add the line:
<allow-navigation href="*" />
in the config.xml
file, under tag <widget>
.
Upvotes: 5
Reputation: 1165
Sorry it's a little unclear to me what you're trying to achieve: Either trying to get to the first HTML page in your app that's in the www folder in your Cordova project, or trying to get to a web site that isn't part of your app but hosted on a web server.
For the later situation, it's dangerous to run external code in your app which is why. To have a web site load so it appears as if it's in your app, you can use the In-App Browser Plugin: https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-inappbrowser/
For the former situation, if your start HTML file in the www folder is called say "index.html", then all you'll need is <content src="index.html" />
in your config.xml file.
Upvotes: 0