> For the complete documentation index, see [llms.txt](https://ja.docs.monaca.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ja.docs.monaca.io/reference/config/ios/config_xml.md).

# config.xml

`config.xml` 設定ファイルを使用して、Cordova のさまざまな設定を管理します。

![](/files/-Mgd7gKD32_6zO2XaGyN)

設定可能な要素と preference を次に記します。必要に応じて設定します。

## \<widget> 要素

| 属性        | 型   | デフォルト値  | 解説                                         |
| --------- | --- | ------- | ------------------------------------------ |
| `version` | 文字列 | `1.0.0` | A version number which is visible to users |

**例**

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

## \<content> 要素

| 属性    | 型   | デフォルト値        | 解説                                                                                                                       |
| ----- | --- | ------------- | ------------------------------------------------------------------------------------------------------------------------ |
| `src` | 文字列 | `indext.html` | `<content>` 要素では、アプリ起動時のページを指定します ( 通常、Web アセットを置いた、最上位のディレクトリーにこのページは置かれます )。 `src` 属性の値に、他の URL を指定すれば、起動時のページを変更できます。 |

**例**

```markup
<?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> 要素

| 属性       | 型   | デフォルト値 | 解説                                                                    |
| -------- | --- | ------ | --------------------------------------------------------------------- |
| `origin` | 文字列 | `*`    | アクセスできるネットワークドメインを指定します。 `*` に指定した場合、どのドメインにも、アプリからアクセスできます。your app. |

**例**

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

## \<preference> 要素

`<preference>` タグでは、name と value の組み合わせ形式で、オプションを設定します。preference の name では、大文字小文字は区別されません。preference の多くは、各プラットフォーム毎に設定する必要があります。次の preference に関しては、複数のプラットフォームに適用できます。

| Preference Name              | 型   | デフォルト値    | 解説                                                                                                                                                                                                                                                                                                                                                               |
| ---------------------------- | --- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `DisallowOverScroll`         | 真偽値 | `false`   | `true` に指定した場合、ラバーバンド スクロール ( rubber-band scrolling ) が無効になります。                                                                                                                                                                                                                                                                                                  |
| `EnableViewportScale`        | 真偽値 | `false`   | `true` に指定した場合、ビューポートのスケール方法を指定した `meta` タグを無視します。                                                                                                                                                                                                                                                                                                               |
| `AutoHideSplashScreen`       | 真偽値 | `true`    | `false` に指定した場合、JavaScript API を使用して、スプラッシュ画像の制御を行えます。                                                                                                                                                                                                                                                                                                           |
| `BackupWebStorage`           | 文字列 | `cloud`   | <p>次のいずれかの値を設定できます。 </p><p></p><ul><li><code>none</code>: バックアップを無効にします。</li><li><code>cloud</code>: iCloud へのバックアップを許可します。</li><li><code>local</code>: ローカルへのバックアップ ( iTunes Sync 経由 ) を許可します。</li></ul>                                                                                                                                                        |
| `UIWebViewDecelerationSpeed` | 文字列 | `normal`  | <p>慣性スクロールの減速度を指定します。2 つのオプションがあります。 </p><p></p><ul><li><code>normal</code>: デフォルトでは、こちらを選択します。</li><li><code>fast</code>: Mobile Safari の場合、こちらを選択します。</li></ul>                                                                                                                                                                                                |
| `Orientation`\*              | 文字列 | `default` | <p>画面のオリエンテーションを設定します。次の <code>4</code> つの値を設定できます。 </p><p></p><ul><li><code>all</code>: この設定では、portrait と landscape の両方を使用できます ( プラットフォーム毎の設定時に使用 )。</li><li><code>default</code>: システム側のデフォルトのオリエンテーションを使用します。</li><li><code>landscape</code>: landscape ( 横向き ) のオリエンテーションを使用します。</li><li><code>portrait</code>: portrait ( 縦向き ) のオリエンテーションを使用します。</li></ul> |

**例**

```markup
...
<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. 全プラットフォーム共通の設定方法

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

{% hint style="info" %}
全端末に適用される、グローバルな設定 ( Global Preference ) も使用できますが、設定できる値は、`default`、 `landscape`、 `portrait` のみです。`all` は、グローバルな設定には使用できません。
{% endhint %}

&#x20;   2\. プラットフォーム毎の設定方法

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

{% hint style="info" %}
`default` を設定した場合、Android と Windows ではすべてのオリエンテーションが使用でき、iOS では `portrait` のみ適用されます。
{% endhint %}
