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存儲