Monaca Docs
Search…
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

Attribute
Type
Default Value
Description
version
String
1.0.0
A version number which is visible to users
Example
1
<widget id="com.example.helloworld" version="0.0.1">
2
...
3
</widget>
Copied!

<content> element

Attribute
Type
Default Value
Description
src
String
indext.html
The <content> element defines the app's starting page in the top-level web assets directory. You can change the starting page by changing the value of the src attribute to your preferred URL.
Example
1
<?xml version="1.0" encoding="UTF-8"?>
2
<widget xmlns="http://www.w3.org/ns/widgets" id="com.example.helloworld" version="1.0.0">
3
...
4
<content src="https://monaca.io/" />
5
</widget>
Copied!

<access> element

Attribute
Type
Default Value
Description
origin
String
*
Controls access to specific network domains. If set to *, you can access all domains from your app.
Example
1
...
2
<access origin="*" />
3
...
Copied!

<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.
Preference Name
Type
Default Value
Description
DisallowOverScroll
Boolean
false
Set to true if you want to disable the rubber-band scrolling for WebView.
EnableViewportScale
Boolean
false
Set to true to prevent viewport scaling through a <meta> tag.
AutoHideSplashScreen
Boolean
true
Set to false to control the splashscreen when it’s hidden through a JavaScript API.
BackupWebStorage
String
cloud
There are 3 valid values:
  • none: disables any backups of web storage.
  • cloud: allows the web storage data to be backed up to iCloud.
  • local: allows only local backups (iTunes sync).
UIWebViewDecelerationSpeed
String
normal
Controls the deceleration speed of momentum scrolling. There are 2 valid values:
  • normal: is the default speed for most native apps
  • fast: is the default speed for Mobile Safari.
Orientation*
String
default
(Cordova 5.2 or Higher) There are 4 valid values:
  • all: to specify both portrait & landscape mode you would use the platform specific value all
  • default: screen orientation will be applied according to system default.
  • landscape: set screen orientation to landscape mode.
  • portrait: set screen orientation to portrait mode.
Example
1
...
2
<preference name="DisallowOverscroll" value="false" />
3
<preference name="EnableViewportScale" value="false" />
4
<preference name="AutoHideSplashScreen" value="true" />
5
<preference name="BackupWebStorage" value="cloud" />
6
<preference name="UIWebViewDecelerationSpeed" value="normal" />
7
<preference name="Orientation" value="portrait" />
8
...
Copied!
*: There are two use ways to configure Orientation preference:
  1. 1.
    Global Settings:
    1
    <widget>
    2
    ....
    3
    <preference name="orientation" value="default"/>
    4
    ....
    5
    </widget>
    Copied!
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:
1
<widget>
2
...
3
<platform name="ios">
4
<preference name="orientation" value="default"/>
5
</platform>
6
...
7
</widget>
Copied!
For Android/Windows, default means all directions, but in iOS only portrait will be applied.
Last modified 4mo ago