diff --git a/docs/apis/cookies.md b/docs/apis/cookies.md
index 6f730cb3..1b2e4a5d 100644
--- a/docs/apis/cookies.md
+++ b/docs/apis/cookies.md
@@ -15,9 +15,16 @@ The Capacitor Cookies API provides native cookie support via patching `document.
By default, the patching of `document.cookie` to use native libraries is disabled.
If you would like to enable this feature, modify the configuration below in the `capacitor.config` file.
-| Prop | Type | Description | Default |
-| ------------- | -------------------- | ------------------------------------------------------------------------- | ------------------ |
-| **`enabled`** | boolean | Enable the patching of `document.cookie` to use native libraries instead. | false |
+| Prop | Type | Description | Default | Since |
+| -------------- | -------------------- | ------------------------------------------------------------------------------------ | ------------------ | ----- |
+| **`enabled`** | boolean | Enable the patching of `document.cookie` to use native libraries instead. | false | 4.3.0 |
+| **`disabled`** | boolean | Prevent the plugin from loading on iOS and Android. Takes precedence over `enabled`. | false | 9.1.0 |
+
+`enabled` only controls the patching. With `enabled` unset or `false`, `CapacitorCookies.setCookie()` and the other methods below still work.
+Set `disabled` to `true` to stop the plugin from loading at all: its methods then fail as unimplemented, and `document.cookie` is not patched even if `enabled` is `true`.
+
+On Android, this plugin is also what shares cookies between the web view and native requests made with `HttpURLConnection` (including `CapacitorHttp`), and it clears session cookies when it loads.
+With `disabled: true`, neither happens.
### Example Configuration
diff --git a/docs/apis/http.md b/docs/apis/http.md
index ac599ee4..8cab0bbd 100644
--- a/docs/apis/http.md
+++ b/docs/apis/http.md
@@ -15,9 +15,13 @@ The Capacitor Http API provides native http support via patching `fetch` and `XM
By default, the patching of `window.fetch` and `XMLHttpRequest` to use native libraries is disabled.
If you would like to enable this feature, modify the configuration below in the `capacitor.config` file.
-| Prop | Type | Description | Default |
-| ------------- | -------------------- | ------------------------------------------------------------------------------------ | ------------------ |
-| **`enabled`** | boolean | Enable the patching of `fetch` and `XMLHttpRequest` to use native libraries instead. | false |
+| Prop | Type | Description | Default | Since |
+| -------------- | -------------------- | ------------------------------------------------------------------------------------ | ------------------ | ----- |
+| **`enabled`** | boolean | Enable the patching of `fetch` and `XMLHttpRequest` to use native libraries instead. | false | 4.3.0 |
+| **`disabled`** | boolean | Prevent the plugin from loading on iOS and Android. Takes precedence over `enabled`. | false | 9.1.0 |
+
+`enabled` only controls the patching. With `enabled` unset or `false`, `CapacitorHttp.request()` and the other methods below still work.
+Set `disabled` to `true` to stop the plugin from loading at all: its methods then fail as unimplemented, and `fetch` and `XMLHttpRequest` are not patched even if `enabled` is `true`.
### Example Configuration
diff --git a/docs/main/reference/config.md b/docs/main/reference/config.md
index 9eeebaed..7f0c207f 100644
--- a/docs/main/reference/config.md
+++ b/docs/main/reference/config.md
@@ -779,12 +779,15 @@ export interface PluginsConfig {
/**
* Plugin configuration by class name.
*
+ * Every plugin accepts `disabled` (see `PluginConfig`), for example
+ * `{ plugins: { MyPlugin: { disabled: true } } }`.
+ *
* @since 1.0.0
*/
[key: string]:
- | {
+ | (PluginConfig & {
[key: string]: any;
- }
+ })
| undefined;
/**
@@ -792,10 +795,13 @@ export interface PluginsConfig {
*
* @since 4.3.0
*/
- CapacitorCookies?: {
+ CapacitorCookies?: PluginConfig & {
/**
* Enable CapacitorCookies to override the global `document.cookie` on native.
*
+ * This only controls the patching. The plugin's own methods work either
+ * way; use `disabled` to stop the plugin from loading.
+ *
* @default false
*/
enabled?: boolean;
@@ -806,10 +812,13 @@ export interface PluginsConfig {
*
* @since 4.3.0
*/
- CapacitorHttp?: {
+ CapacitorHttp?: PluginConfig & {
/**
* Enable CapacitorHttp to override the global `fetch` and `XMLHttpRequest` on native.
*
+ * This only controls the patching. The plugin's own methods work either
+ * way; use `disabled` to stop the plugin from loading.
+ *
* @default false
*/
enabled?: boolean;
@@ -820,7 +829,7 @@ export interface PluginsConfig {
*
* @since 8.0.0
*/
- SystemBars?: {
+ SystemBars?: PluginConfig & {
/**
* Specifies how to handle problematic insets on Android.
*
@@ -881,6 +890,31 @@ export interface PluginsConfig {
};
}
+export interface PluginConfig {
+ /**
+ * Prevent the plugin's native implementation from being registered and
+ * loaded on iOS and Android.
+ *
+ * A disabled plugin is not available to the app:
+ * `Capacitor.isPluginAvailable()` returns `false` and calls to its methods
+ * fail as unimplemented.
+ *
+ * This is different from the `enabled` option of `CapacitorHttp` and
+ * `CapacitorCookies`, which only controls the patching of `fetch`,
+ * `XMLHttpRequest` and `document.cookie`. `disabled: true` takes precedence
+ * over `enabled: true`.
+ *
+ * Plugins that declare their own configuration type don't list `disabled`,
+ * so TypeScript rejects it in `capacitor.config.ts`. Set it in
+ * `capacitor.config.json` instead, or cast the plugin's configuration, for
+ * example `SplashScreen: { disabled: true } as any`.
+ *
+ * @since 9.1.0
+ * @default false
+ */
+ disabled?: boolean;
+}
+
export interface PackageOptions {
/**
* Create a symlink to the plugin folder instead of pointing to the plugin path.