Window object is undefined in Cordova app

So I have a cordova app withe WebView implemented. This is my MainACtivity:

WebView webView = findViewById(R.id.webview);

    WebSettings webSettings = webView.getSettings();
    webSettings.setJavaScriptEnabled(true);
    webSettings.setDomStorageEnabled(true);
    webSettings.setLoadWithOverviewMode(true);
    webSettings.setUseWideViewPort(true);
    webSettings.setBuiltInZoomControls(true);
    webSettings.setDisplayZoomControls(false);
    webSettings.setSupportZoom(true);
    webSettings.setDefaultTextEncodingName("utf-8");
    webSettings.setAllowFileAccessFromFileURLs(true);
    webSettings.setAllowUniversalAccessFromFileURLs(true);
    webView.setWebViewClient(new WebViewClient());

    webView.setWebContentsDebuggingEnabled(true);

I’m able to view my local web app contents which is located in the android_assest directory.
But things like alert, ‘confirm’ ‘window’ object are not working or in case of the window object , its undefined.

So something like alert("Hello World") is not working.

Why would this be happening? What am I doing wrong?

Source: New feed
Source Url Window object is undefined in Cordova app