ARTICLE AD BOX
I’m trying to understand if a different WebView architecture is possible in a Capacitor app.
From what I understand, Capacitor initializes a main WebView that is connected to the Capacitor bridge, which exposes all plugins to JavaScript through window.Capacitor.Plugins.
Normally the web application runs inside this WebView and communicates with native plugins through the bridge.
What I want to do
Instead of using the main Capacitor WebView to load the app:
Keep the main Capacitor WebView empty or blank
Create a separate native WebView
Load my entire app inside this custom WebView
Keep that custom WebView running normally
Still be able to use all Capacitor plugins from the custom WebView
So the structure would look like this:
Native App ├── Capacitor Main WebView (blank / only bridge) └── Custom Native WebView (loads the entire web app)Goal
The goal is for the custom WebView to behave exactly like the Capacitor WebView, meaning:
access to window.Capacitor
ability to call all plugins (Camera, Filesystem, etc.)
full communication with the Capacitor bridge
My Questions
Is it possible for a secondary custom WebView to connect to the Capacitor bridge?
Can the main Capacitor WebView stay blank while another WebView runs the actual app?
Would this require modifying the Bridge class or creating a custom bridge instance for the second WebView?
Has anyone successfully used multiple WebViews with Capacitor while keeping plugin access working?
From the Android implementation, it seems the Capacitor bridge manages the WebView configuration, plugin registration, and message handling between JavaScript and native code.
Because of this, I’m unsure if plugins will only work with the WebView that the bridge was initialized with, or if another WebView can be attached to the same bridge.
Any guidance or examples would be greatly appreciated.
Thanks!
