Webview.android get Undefined in Android



I get Error as webview.android is undefined as I made Component which is having webview that is extended by setWebChromeClient()
and I have used the same component in subpage that is child page in the first page it works well but in second it get undefined in the same component is there any solution so that I can also get the facility for subpages

 let webview: WebView = this.webViewRef.nativeElement;
if(webview.android || isAndroid) { // in IOS android will be undefined
            console.log("Inside android");
            let myWebChromeClient: MyWebChromeClient = new MyWebChromeClient(this.getCookies());

Here in gettsetting not callled in subpage but it is work in first page

this function is called in onInit method of component


onInit is not the right place to do that, try after view init or the loaded method of webview which guarantees that the native view is created and ready to use.


ok but i have to set cookie too


Thank Done on onLoaded event