can't open twitter url in android webview

前端 未结 3 1465
我寻月下人不归
我寻月下人不归 2021-01-20 10:54

I have a problem in my ANDROID application.

I would like to display a twitter page in my webview but the URL won\'t open.

It keeps loading infinitely.

相关标签:
3条回答
  • 2021-01-20 11:26

    Your problem is that your shouldOverrideUrlLoading needs to return true to indicate that the host application is managing the load:

    private class ApplicationWebViewClient extends WebViewClient { 
        @Override 
        public boolean shouldOverrideUrlLoading(WebView view, String url) 
        {
            view.loadUrl(url);
            return true;
        }
    }
    
    0 讨论(0)
  • 2021-01-20 11:28

    I had to set the User Agent String on the webview to get it to work.

    wv.getSettings().setUserAgentString("silly_that_i_have_to_do_this");

    and that worked for me.

    Hope it helps someone else!

    0 讨论(0)
  • 2021-01-20 11:45
    wv.getSettings().setDomStorageEnabled(true);
    

    This worked for me!

    0 讨论(0)
提交回复
热议问题