Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Website open in browser but not work in WebView [closed]

I have tried many times to open this link in webview (https://www.prpal.com/#/) but all time failed

This link is working in all browsers in Android or iOS.

Please someone help me to open this link in webview in Android studio

webView=(WebView)findViewById(R.id.webView);
webView.getSettings().setJavaScriptEnabled(true);
webView.setWebViewClient(new WebViewClient(){
    @Override
    public void onReceivedSslError(WebView view, SslErrorHandler 
    handler, SslError error) {
        handler.proceed();
    }
});
webView.loadUrl("https://www.prpal.com/#/");
webView.setWebChromeClient(new WebChromeClient());

}

like image 838
Fahad Sharif Avatar asked Nov 21 '25 14:11

Fahad Sharif


1 Answers

I've tested it and I found the issue, you are missing setDomStorageEnabled()

Sets whether the WebView will enable smooth transition while panning or zooming or while the window hosting the WebView does not have focus. If it is true, WebView will choose a solution to maximize the performance. e.g. the WebView's content may not be updated during the transition. If it is false, WebView will keep its fidelity. The default value is false.

New code is :

webView=(WebView)findViewById(R.id.wb_test);
    webView.setWebViewClient(new WebViewClient(){
        @Override
        public void onReceivedSslError(WebView view, SslErrorHandler
                handler, SslError error) {
            handler.proceed();
        }
    });

    WebSettings webSettings = webView.getSettings();
    webSettings.setJavaScriptEnabled(true);
    webSettings.setDomStorageEnabled(true);
    webView.setWebChromeClient(new WebChromeClient());
    webView.loadUrl("https://www.prpal.com/#/");

This is the output :

enter image description here

like image 198
Skizo-ozᴉʞS Avatar answered Nov 24 '25 03:11

Skizo-ozᴉʞS