From e29d313e95820d31713554fab73aa4246f419461 Mon Sep 17 00:00:00 2001 From: Bo Liu Date: Fri, 22 Apr 2016 16:23:22 -0700 Subject: [PATCH] WebView doc: explain persist js across navigations BUG: 28207652 Change-Id: Ib33f029c2cae6c1482c0c951075275e9f96ae73c --- core/java/android/webkit/WebView.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index b16508ea6afa1..ada77318f2971 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -890,6 +890,8 @@ public class WebView extends AbsoluteLayout /** * Loads the given URL with the specified additional HTTP headers. + *

+ * Also see compatibility note on {@link #evaluateJavascript}. * * @param url the URL of the resource to load * @param additionalHttpHeaders the additional headers to be used in the @@ -906,6 +908,8 @@ public class WebView extends AbsoluteLayout /** * Loads the given URL. + *

+ * Also see compatibility note on {@link #evaluateJavascript}. * * @param url the URL of the resource to load */ @@ -1006,6 +1010,12 @@ public class WebView extends AbsoluteLayout * If non-null, |resultCallback| will be invoked with any result returned from that * execution. This method must be called on the UI thread and the callback will * be made on the UI thread. + *

+ * Compatibility note. Applications targeting {@link android.os.Build.VERSION_CODES#N} or + * later, JavaScript state from an empty WebView is no longer persisted across navigations like + * {@link #loadUrl(String)}. For example, global variables and functions defined before calling + * {@link #loadUrl(String)} will not exist in the loaded page. Applications should use + * {@link #addJavascriptInterface} instead to persist JavaScript objects across navigations. * * @param script the JavaScript to execute. * @param resultCallback A callback to be invoked when the script execution