Deeplinking
The Capacitor Community Electron platform comes with a utility for enabling easy deeplinking for your applications.
How To Implement#
- Enable deepliking by adding the property
deepLinkingEnabled: trueto your capacitor.config file under theelectronproperty.
...const config = { appId: 'com.company.appname', appName: 'My Capacitor App', webDir: 'www', electron: { deepLinkingEnabled: true, }};...- If you dont want your app to use the default custom protocol of
mycapacitorappyou will need to add another property to theelectronprop. in the config file of:deepLinkingCustomProtocol: 'mycustomprotocol'where you can set anything you wish as the custom protocol.
...const config = { appId: 'com.company.appname', appName: 'My Capacitor App', webDir: 'www', electron: { deepLinkingEnabled: true, deepLinkingCustomProtocol: 'mycustomprotocol', }};...- From here you will need a plugin to handle the deep linking inside your webapp. The official
Appplugin from capacitor will handle this for example.