npm

Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript.Learn more »

cordova-plugin-webview-switch

0.2.0 • Public • Published

cordova-plugin-webview-switch

Experimental plugin to switch the webview at runtime. Please read warning before trying.

Attention ⚠️

This plugin only loads webviews, installed as plugins, like WKWebView or Ionic WKWebView. App crashes and incompatibilities with Cordova updates may occurr.

If callbacks from plugins fire after reloading the webview, the app will crash.

Use with caution!

After calling load() the main view in the app will restart!

Usage

iOS only now

WebViews must be installed as plugins such as:

Install WKWebview plugin(s) and configure it as default in config.xml:

<feature name="CDVWKWebViewEngine">
  <param name="ios-package" value="CDVWKWebViewEngine" />
</feature>
 
<preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />

This plugin creates the global Javascript object WebviewSwitch which has the funtion load()to switch.

Examples:

  • Switch to default Cordova UIWebview at runtime: WebviewSwitch.load('CDVUIWebViewEngine')
  • Switch to WKWebview at runtime: WebviewSwitch.load('CDVWKWebViewEngine')
  • The In-App-Browser plugin works too and shares the session. But don´t forget to set usewkwebview to the correct value if you need a shared session.

install

npm i cordova-plugin-webview-switch

Downloadsweekly downloads

26

version

0.2.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
  • avatar
Report a vulnerability