config.xml

The config.xml file is a settings file controlling various settings of Cordova.

Below are available elements and preferences you may need to configure:

<widget> element

Example

<widget id="com.example.helloworld" version="0.0.1">
  ...
</widget>

<content> element

Example

<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns="http://www.w3.org/ns/widgets" id="com.example.helloworld" version="1.0.0">
  ...
  <content src="https://monaca.io/" />
</widget>

<access> element

Example

...
<access origin="*" />
...

<preference> element

The <preference> tag sets various options as pairs of name/value attributes. Each preference's name is case-insensitive. Many preferences are unique to specific platforms, as listed at the top of this page. The following sections detail preferences that apply to more than one platform.

Example

...
<preference name="DisallowOverscroll" value="false" />
<preference name="EnableViewportScale" value="false" />
<preference name="AutoHideSplashScreen" value="true" />
<preference name="BackupWebStorage" value="cloud" />
<preference name="UIWebViewDecelerationSpeed" value="normal" />
<preference name="Orientation" value="portrait" />
...

*: There are two use ways to configure Orientation preference:

  1. Global Settings:

    <widget>
    ....
    <preference name="orientation" value="default"/>
    ....
    </widget>

It is also possible to apply the setting for all devices at once; however, you can only use default, landscape and portrait value. all is not possible for Global Settings.

2. Platform Specific Settings:

<widget>
...
<platform name="ios">
 <preference name="orientation" value="default"/>
</platform>
...
</widget>

For Android/Windows, default means all directions, but in iOS only portrait will be applied.

Last updated