diff options
| author | 2024-01-18 18:07:09 -0800 | |
|---|---|---|
| committer | 2024-01-18 18:09:50 -0800 | |
| commit | bb5ba4b22dcefdbc67462ecf89e7f2f44a63b537 (patch) | |
| tree | aecd81a19aab707aafaac3c91416865cfd870a55 | |
| parent | 5cd1f906dce40b1957d95c2b4c0079c1a1860c28 (diff) | |
WebView: document when shouldOverrideUrlLoading happens
No change to logic. This clarifies a long-standing behavior of Android
WebView's shouldOverrideUrlLoading callback.
Bug: 320282942
Test: None
Change-Id: I72cb0bef2742597bb18c9b2eea8d2315d7798ad1
| -rw-r--r-- | core/java/android/webkit/WebViewClient.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/core/java/android/webkit/WebViewClient.java b/core/java/android/webkit/WebViewClient.java index 2dfeae3567e5..80aad60d8bc4 100644 --- a/core/java/android/webkit/WebViewClient.java +++ b/core/java/android/webkit/WebViewClient.java @@ -65,6 +65,14 @@ public class WebViewClient { * {@code true} causes the current WebView to abort loading the URL, while returning * {@code false} causes the WebView to continue loading the URL as usual. * + * <p>This callback is not called for all page navigations. In particular, this is not called + * for navigations which the app initiated with {@code loadUrl()}: this callback would not serve + * a purpose in this case, because the app already knows about the navigation. This callback + * lets the app know about navigations initiated by the web page (such as navigations initiated + * by JavaScript code), by the user (such as when the user taps on a link), or by an HTTP + * redirect (ex. if {@code loadUrl("foo.com")} redirects to {@code "bar.com"} because of HTTP + * 301). + * * <p class="note"><b>Note:</b> Do not call {@link WebView#loadUrl(String)} with the request's * URL and then return {@code true}. This unnecessarily cancels the current load and starts a * new load with the same URL. The correct way to continue loading a given URL is to simply |