How to make links open within webview or open by default browser depending on domain name?

后端 未结 3 1572
梦毁少年i
梦毁少年i 2020-12-16 05:56

I have WebView in which I want to open links belong to domain www.example.org in webview while all other links (if clicked) open by the default browser outside of my applica

3条回答
  •  难免孤独
    2020-12-16 06:35

    If you can't be bothered to explain what "does not work properly" means, we can't be bothered to give you much specific help.

    Use shouldOverrideUrlLoading(). Examine the supplied URL. If it is one you want to keep in the WebView, call loadUrl() on the WebView with the URL and return true. Otherwise, return false and let Android handle it normally.

提交回复
热议问题