/*
- * Copyright © 2016-2020 Soren Stoutner <soren@stoutner.com>.
+ * Copyright © 2016-2021 Soren Stoutner <soren@stoutner.com>.
*
* This file is part of Privacy Browser <https://www.stoutner.com/privacy-browser>.
*
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import android.webkit.WebView;
import android.webkit.WebViewClient;
}
@Override
- public WebResourceResponse shouldInterceptRequest(WebView webView, String url) {
- // Have the WebView asset loader process the request. This allows loading of SVG files, which otherwise is prevented by the CORS policy.
- return webViewAssetLoader.shouldInterceptRequest(Uri.parse(url));
+ public WebResourceResponse shouldInterceptRequest(WebView webView, WebResourceRequest webResourceRequest) {
+ // Have the WebView asset loader process the request.
+ // This allows using the `appassets.androidplatform.net` URL, which handles the loading of SVG files, which otherwise is prevented by the CORS policy.
+ return webViewAssetLoader.shouldInterceptRequest(webResourceRequest.getUrl());
}
});