Back to Blog Home
← all posts

Plugin: nativescript-webview-interface

February 5, 2016 — by Dan Wilson

One of the main benefits of NativeScript is your application is a pure native application. NativeScript views (controls) are abstractions for native platform controls. This means the NativeScript Button view renders an instance of android.widget.Button on Android and an instance of UIButton on iOS. Being native has a tremendous amount of advantages over hybrid mobile application architecture where a DOM based on HTML is manipulated with Javascript inside of a WebView.

However, from time to time, you will need a WebView in a mobile application. Perhaps you need to reuse a layout that is based on HTML. Perhaps your native application is creating HTML layouts and you need the WebView to do an on-device preview. NativeScript has you covered in these cases with our cross-platform WebView component for web content.

A few days ago, I found nativescript-webview-interface, a NativeScript plugin hosted on NPM that makes bi-directional communcation easier between the WebView and the iOS or Android runtime. The plugin author,  Shripal Soni also wrote a very detailed post showing how one might use this plugin to handle the more common cases for this feature.

Read more here: http://shripalsoni.com/blog/nativescript-webview-native-bi-directional-communication/