summaryrefslogtreecommitdiff
path: root/core/java/android/webkit/WebView.java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android/webkit/WebView.java')
-rw-r--r--core/java/android/webkit/WebView.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 2171fc52a0ba..3555822b1f1f 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -760,7 +760,7 @@ public class WebView extends AbsoluteLayout
* <p>
* The {@code encoding} parameter specifies whether the data is base64 or URL
* encoded. If the data is base64 encoded, the value of the encoding
- * parameter must be 'base64'. HTML can be encoded with {@link
+ * parameter must be {@code "base64"}. HTML can be encoded with {@link
* android.util.Base64#encodeToString(byte[],int)} like so:
* <pre>
* String unencodedHtml =
@@ -768,11 +768,15 @@ public class WebView extends AbsoluteLayout
* String encodedHtml = Base64.encodeToString(unencodedHtml.getBytes(), Base64.NO_PADDING);
* webView.loadData(encodedHtml, "text/html", "base64");
* </pre>
- * <p>
+ * <p class="note">
* For all other values of {@code encoding} (including {@code null}) it is assumed that the
* data uses ASCII encoding for octets inside the range of safe URL characters and use the
* standard %xx hex encoding of URLs for octets outside that range. See <a
* href="https://tools.ietf.org/html/rfc3986#section-2.2">RFC 3986</a> for more information.
+ * Applications targeting {@link android.os.Build.VERSION_CODES#Q} or later must either use
+ * base64 or encode any {@code #} characters in the content as {@code %23}, otherwise they
+ * will be treated as the end of the content and the remaining text used as a document
+ * fragment identifier.
* <p>
* The {@code mimeType} parameter specifies the format of the data.
* If WebView can't handle the specified MIME type, it will download the data.
@@ -820,7 +824,8 @@ public class WebView extends AbsoluteLayout
* <p>
* If the base URL uses the data scheme, this method is equivalent to
* calling {@link #loadData(String,String,String) loadData()} and the
- * historyUrl is ignored, and the data will be treated as part of a data: URL.
+ * historyUrl is ignored, and the data will be treated as part of a data: URL,
+ * including the requirement that the content be URL-encoded or base64 encoded.
* If the base URL uses any other scheme, then the data will be loaded into
* the WebView as a plain string (i.e. not part of a data URL) and any URL-encoded
* entities in the string will not be decoded.