(Android Studio) WebView gets loads the page and does not open

I am making an application that gathers some site, but some of them gets loaded in WebView and does not open. As an example I will use the website of UrPay . I have seen this site being opened by another application, by the way it opens normally as if you in Google Chrome.

File .xml

android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Mibank_Activity">


<WebView
    android:id="@+id/webview_Urpay"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

File .java

private WebView webView;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_urpay_);

    setTitle("URPAY");

    webView = (WebView) findViewById(R.id.webview_Urpay);
    WebSettings webSettings = webView.getSettings();
    webSettings.setJavaScriptEnabled(true);
    webView.setWebViewClient(new WebViewClient());
    webView.loadUrl("https://conta.urpay.com.br/entrar");
}

The site keeps loading and never opens. This would be setting my WebView?

Author: Ronison Matos, 2019-03-26

1 answers

Add this brother here that will give good "webSettings.setDomStorageEnabled (true); " your class will look like this

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_urpay_);

setTitle("URPAY");

webView = (WebView) findViewById(R.id.webview_Urpay);
WebSettings webSettings = webView.getSettings();
webSettings.setDomStorageEnabled(true);
webSettings.setJavaScriptEnabled(true);
webView.setWebViewClient(new WebViewClient());
webView.loadUrl("https://conta.urpay.com.br/entrar");

}

 1
Author: Denis Gonçalves, 2019-04-03 00:11:40