Cordova config.xml文件

这是可以改变应用程序的配置的地方。在上一个教程中创建应用程序时我们设置反向域名和名称。这值是可以在 config.xml 文件中更改的。当我们创建应用程序,默认的配置文件也将被创建。打开 D:\worksp\cordova\CordovaProject\config.xml 文件,其代码如下:
<?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>CordovaApp</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="index.html" />
    <plugin name="cordova-plugin-whitelist" spec="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>

下表说明 config.xml 配置每个元素。

config.xml配置表

元素 详细
widget
在创建应用程序时指定的应用程序反向域值
name
在创建应用程序时指定的应用程序的名称
description
应用程序的说明
author 应用程序的作者
content
应用程序的开始页面。它放在 www 目录内
plugin
目前已安装的插件
access 用于控制访问到外部域。默认原始值被设定为*,它表示允许访问的任何域。 此值不会允许某些特定的URL被打开,主要用以保护信息
allow-intent 可让特定网址要求的应用程序打开。 例如, <allow-intent href = "tel:*" /> 将允许电话:链接打开拨号程序
platform
用于构建应用程序的平台


上一篇: Cordova第一个应用 下一篇: Cordova存储