问题
Background
(Per this answer and its question) I have a fully responsive web app hosted at http://www.example.com
and I just want my mobile app to point the user there.
I followed this procedure:
$ cordova create myProject
- Open
config.xml
- Change
index.html
tohttp://www.example.com
Now I have the following config.xml
file.
<?xml version='1.0' encoding='utf-8'?>
<widget id="io.cordova.hellocordova" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>HelloCordova</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="dev@cordova.apache.org" href="http://cordova.io">
Apache Cordova Team
</author>
<content src="http://www.example.com" />
<plugin name="cordova-plugin-whitelist" version="1" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
<allow-intent href="market:*" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
</widget>
Problem
When I use PhoneGap Build and test my .apk file, the result does not perform as expected. Instead of seeing the web page at example.com, I appear to get the original index.html file anyway!
Question
What am I doing wrong? How can I get this mobile app to point to my desired URL at example.com?
回答1:
@Mowzer
UPDATE: 2015-11-21:
As of Nov 20, 2015 at 1pm PST, <platform (...)>
is a viable element for config.xml
.
See the Phonegap Build blog post "config.xml gets an update - part 2 !!!!!!"
Where are you getting this example code? I've now seen dozens of copy and they ALL have the same mistake. Namely, platform
does NOT apply to Phonegap Build. The main reason is <platform (...)>
only applies to Cordova/Phonegap SDK. (It took me along time to figure this out. SEE #1 near the bottom.
In addition, the whitelist
system is NOT being applied correctly. I'd like to find this source and get it corrected.
Your Corrections:
Luckily you are not too far along. Remove all the whitelist
stuff and start here.
HOW TO apply the Cordova/Phonegap the whitelist system
Please let me know where you got this example from.
TIA Jesse
来源:https://stackoverflow.com/questions/33642118/how-to-phonegap-build-navigate-to-web-app-instead-of-index-html