[Android] shouldOverrideUrlLoading 處理方式


此方法已经被标记为废弃,方法的第二个参数类型为String,在Android 7.0以下系统被调用

    @Deprecated
   public boolean shouldOverrideUrlLoading(WebView view, String url) {
        return false; //返回false 表示觸發webview.load(url)
   }
/**
     * @param view The WebView that is initiating the callback.
     * @param request Object containing the details of the request.
     * @return {@code true} to cancel the current load, otherwise return {@code false}.
     */
    public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
        return shouldOverrideUrlLoading(view, request.getUrl().toString());
////返回false  表示不處理這個url
}

留言

熱門文章