콘텐츠로 건너뛰기

Getting Started

이 콘텐츠는 아직 귀하의 언어로 제공되지 않습니다.

  1. Install the package

    Terminal window
    npm i @capgo/capacitor-webview-version-checker
  2. Sync native projects

    Terminal window
    npx cap sync
  3. Optional: add plugin config You can run with defaults (WebviewVersionChecker: {}) or customize prompt and threshold behavior in capacitor.config.ts.

By default, this plugin uses a Browserslist-style compatibility rule:

  • minimumDeviceSharePercent defaults to 3
  • the share dataset is bundled at build time from caniuse data
  • no runtime dataset URL call is needed for the default flow
import type { CapacitorConfig } from '@capacitor/cli';
const config: CapacitorConfig = {
plugins: {
WebviewVersionChecker: {},
},
};
export default config;

Simple config-only setup (show native prompt)

Section titled “Simple config-only setup (show native prompt)”
import type { CapacitorConfig } from '@capacitor/cli';
const config: CapacitorConfig = {
plugins: {
WebviewVersionChecker: {
autoPromptOnOutdated: true,
},
},
};
export default config;
import type { CapacitorConfig } from '@capacitor/cli';
const config: CapacitorConfig = {
plugins: {
WebviewVersionChecker: {
minimumDeviceSharePercent: 3,
versionShareByMajor: {
'137': 58.2,
'136': 21.3,
'135': 4.6,
'134': 2.1,
},
autoPromptOnOutdated: true,
},
},
};
export default config;

Use this only if you want compatibility based on real-world share instead of only a fixed version.

  • minimumDeviceSharePercent: 3 means the installed major version must represent at least 3% in your dataset.
  • versionShareByMajor is your custom map: major version => percentage.
  • If you prefer remote data, use versionShareApiUrl with one of:
    • { "versionShareByMajor": { "137": 54.2, "136": 23.8 } }
    • { "shareByMajor": { "137": 54.2, "136": 23.8 } }
    • { "versions": [{ "major": 137, "share": 54.2 }, { "version": "136.0.0.0", "percent": 23.8 }] }
import { WebviewVersionChecker } from '@capgo/capacitor-webview-version-checker';
await WebviewVersionChecker.addListener('webViewOutdated', (status) => {
console.log('Outdated WebView detected', status);
});
await WebviewVersionChecker.check({
minimumMajorVersion: 124,
showPromptOnOutdated: true,
});

Why use this plugin instead of only Capacitor config

Section titled “Why use this plugin instead of only Capacitor config”

Capacitor supports static minimum checks:

android: {
minWebViewVersion: 124,
},
server: {
errorPath: 'unsupported-webview.html',
}

This plugin adds runtime events and native prompt UX, so users can still open and use the app while being encouraged to update.

Evaluation order:

  1. Device-share threshold mode (minimumDeviceSharePercent + dataset), if provided
  2. Latest version mode (latestVersion / latestVersionApiUrl)
  3. Minimum major fallback (minimumMajorVersion)

The plugin supports both WebView provider models used by Capacitor on Android:

  • Android 5-6 and 10+: Android System WebView (com.google.android.webview)
  • Android 7-9: Google Chrome (com.android.chrome)