diff --git a/app/src/main/java/io/legado/app/help/JsExtensions.kt b/app/src/main/java/io/legado/app/help/JsExtensions.kt index 4c9cf31fe..8e8c46e65 100644 --- a/app/src/main/java/io/legado/app/help/JsExtensions.kt +++ b/app/src/main/java/io/legado/app/help/JsExtensions.kt @@ -218,6 +218,19 @@ interface JsExtensions { .execute() } + /** + * js实现重定向拦截,网络访问head,不返回Response Body更省流量 + */ + fun head(urlStr: String, headers: Map): Connection.Response { + return Jsoup.connect(urlStr) + .sslSocketFactory(SSLHelper.unsafeSSLSocketFactory) + .ignoreContentType(true) + .followRedirects(false) + .headers(headers) + .method(Connection.Method.HEAD) + .execute() + } + /** * 网络访问post */