Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions agentweb-core/src/main/java/com/just/agentweb/DefaultWebClient.java
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,14 @@ public class DefaultWebClient extends MiddlewareWebClientBase {
* SMS scheme
*/
public static final String SCHEME_SMS = "sms:";
/**
* file scheme - locally bundled assets and on-device files.
*/
public static final String FILE_SCHEME = "file://";
/**
* javascript: scheme - bookmarklet-style URLs the WebView itself evaluates.
*/
public static final String JAVASCRIPT_SCHEME = "javascript:";
/**
* 缓存当前出现错误的页面
*/
Expand Down Expand Up @@ -189,6 +197,13 @@ public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request
if (url.startsWith(HTTP_SCHEME) || url.startsWith(HTTPS_SCHEME)) {
return (webClientHelper && HAS_ALIPAY_LIB && isAlipay(view, url));
}
// Issue #762: navigations to file:// (e.g. links between bundled assets)
// and javascript: URLs must be handled by WebView itself. Letting them
// fall through into the unknown-URL branch below causes
// mIsInterceptUnkownUrl to silently drop the navigation.
if (url.startsWith(FILE_SCHEME) || url.startsWith(JAVASCRIPT_SCHEME)) {
return false;
}
if (!webClientHelper) {
return super.shouldOverrideUrlLoading(view, request);
Comment on lines +204 to 208
}
Expand Down Expand Up @@ -278,6 +293,13 @@ public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (url.startsWith(HTTP_SCHEME) || url.startsWith(HTTPS_SCHEME)) {
return (webClientHelper && HAS_ALIPAY_LIB && isAlipay(view, url));
}
// Issue #762: navigations to file:// (e.g. links between bundled assets)
// and javascript: URLs must be handled by WebView itself. Letting them
// fall through into the unknown-URL branch below causes
// mIsInterceptUnkownUrl to silently drop the navigation.
if (url.startsWith(FILE_SCHEME) || url.startsWith(JAVASCRIPT_SCHEME)) {
return false;
}
if (!webClientHelper) {
return false;
}
Expand Down
Loading