Skip to content

Commit

Permalink
docs(Plugins): add information about how to override navigation (#2923)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile committed May 14, 2020
1 parent bdce166 commit 63c8542
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions site/docs-md/plugins/android.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,13 @@ protected void handleRequestPermissionsResult(int requestCode, String[] permissi
}
```

### Override navigation

Capacitor plugins can override the webview navigation. For that the plugin can override `public Boolean shouldOverrideLoad(Uri url)` method.
Returning `true` causes the WebView to abort loading the URL.
Returning `false` causes the WebView to continue loading the URL.
Returning `null` will defer to the default Capacitor policy.

### Export to Capacitor

By using the `@NativePlugin` and `@PluginMethod()` annotations in your plugins, you make them available to Capacitor, but you still need an extra step in your application to make Capacitor aware of the plugins.
Expand Down
6 changes: 6 additions & 0 deletions site/docs-md/plugins/ios.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,12 @@ const myPluginEventListener = Plugins.MyPlugin.addListener("myPluginEvent", (inf
myPluginEventListener.remove();
```

### Override navigation

Capacitor plugins can override the webview navigation. For that the plugin can override `- (NSNumber *)shouldOverrideLoad:(WKNavigationAction *)navigationAction` method.
Returning `true` causes the WebView to abort loading the URL.
Returning `false` causes the WebView to continue loading the URL.
Returning `nil` will defer to the default Capacitor policy.

### Export to Capacitor

Expand Down

0 comments on commit 63c8542

Please sign in to comment.