NativeScript Android Advanced Webview
This plugin will allow you to use some of advance feature of Android Webview. This plugin is using following library
Android: Android-AdvancedWebView
Note: I am not an expert of neigher iOS nor Android. So, please contribute if you think something you can do for better :)
Installation
tns plugin add nativescript-android-advanced-webview
Usage (Angular)
;; { let advanceWebview: AndroidAdvancedWebview = thispage; let optons: AndroidAdvanceWebviewOptions = android: setGeolocationEnabled: false setCookiesEnabled: true advanceWebview; advanceWebview advanceWebview}
HTML:
<AdvanceWebview id="webview" src="https://google.com"></AdvanceWebview>
Advance Configuration for WebViewClient or WebChromeClient class. You will need to implement your own customized override methods. You can do almost everything here :). You can install tns-platform-declarations
for avoiding typescript error. Please check the demo for more details.
advanceWebview; //android.webkit.WebViewClient classadvanceWebview; //android.webkit.WebChromeClient
Class can be extend like this:
webkitWebViewClient { super; return global; } public : void console; public : void console; public : void console; webkitWebChromeClient { super; return global; } public : void console; public : void console; request;
API
Events: started, finished, error, downloadRequested, externalPageRequest
You can get more events by extending WebViewClient or WebChromeClient class like onReceivedTitle
, onPermissionRequest
(for allowing microphone) etc. This plugin also has some limitations too. You can check the library repository for more details.
android?: setGeolocationEnabled?: boolean; addHttpHeader?: request: string; value: string; ; addPermittedHostname?: string; preventCaching?: boolean; setThirdPartyCookiesEnabled?: boolean; setCookiesEnabled?: boolean; setMixedContentAllowed?: boolean; setDesktopMode?: boolean; loadHtml?: boolean;;
Details here: https://github.com/delight-im/Android-AdvancedWebView
License
MIT
author: Jibon L. Costa