In a WebView is there a way for shouldOverrideUrlLoading to determine if it is catching a redirect vs. a user clicking a link?

前端 未结 6 576
时光说笑
时光说笑 2021-02-01 06:06

I would like to allow redirects to happen naturally in the WebView and only catch a new url if it is a happening because a user clicked something.

6条回答
  •  一向
    一向 (楼主)
    2021-02-01 06:27

    In SDK 24. can get the result by the new shouldOverrideUrlLoading(WebView view, WebResourceRequest request),

    there is a method isRedirect() in WebResourceRequest which gets whether the request was a result of a server-side redirect.

提交回复
热议问题