/**@class android.webkit.WebView implements android.view.ViewTreeObserver.OnGlobalFocusChangeListener implements android.view.ViewGroup.OnHierarchyChangeListener implements android.view.ViewDebug.HierarchyHandler @extends android.widget.AbsoluteLayout <p>A View that displays web pages. This class is the basis upon which you can roll your own web browser or simply display some online content within your Activity. It uses the WebKit rendering engine to display web pages and includes methods to navigate forward and backward through a history, zoom in and out, perform text searches and more.</p> <p>Note that, in order for your Activity to access the Internet and load web pages in a WebView, you must add the {@code INTERNET} permissions to your Android Manifest file:</p> <pre><uses-permission android:name="android.permission.INTERNET" /></pre> <p>This must be a child of the <a href="{@docRoot}guide/topics/manifest/manifest-element.html">{@code <manifest>}</a> element.</p> <p>For more information, read <a href="{@docRoot}guide/webapps/webview.html">Building Web Apps in WebView</a>.</p> <h3>Basic usage</h3> <p>By default, a WebView provides no browser-like widgets, does not enable JavaScript and web page errors are ignored. If your goal is only to display some HTML as a part of your UI, this is probably fine; the user won't need to interact with the web page beyond reading it, and the web page won't need to interact with the user. If you actually want a full-blown web browser, then you probably want to invoke the Browser application with a URL Intent rather than show it with a WebView. For example: <pre> Uri uri = Uri.parse("http://www.example.com"); Intent intent = new Intent(Intent.ACTION_VIEW, uri); startActivity(intent); </pre> <p>See {@link android.content.Intent} for more information.</p> <p>To provide a WebView in your own Activity, include a {@code <WebView>} in your layout, or set the entire Activity window as a WebView during {@link android.app.Activity#onCreate(Bundle) onCreate()}:</p> <pre class="prettyprint"> WebView webview = new WebView(this); setContentView(webview); </pre> <p>Then load the desired web page:</p> <pre> // Simplest usage: note that an exception will NOT be thrown // if there is an error loading this page (see below). webview.loadUrl("http://slashdot.org/"); // OR, you can also load from an HTML string: String summary = "<html><body>You scored <b>192</b> points.</body></html>"; webview.loadData(summary, "text/html", null); // ... although note that there are restrictions on what this HTML can do. // See the JavaDocs for {@link #loadData(String,String,String) loadData()} and {@link #loadDataWithBaseURL(String,String,String,String,String) loadDataWithBaseURL()} for more info. </pre> <p>A WebView has several customization points where you can add your own behavior. These are:</p> <ul> <li>Creating and setting a {@link android.webkit.WebChromeClient} subclass. This class is called when something that might impact a browser UI happens, for instance, progress updates and JavaScript alerts are sent here (see <a href="{@docRoot}guide/developing/debug-tasks.html#DebuggingWebPages">Debugging Tasks</a>). </li> <li>Creating and setting a {@link android.webkit.WebViewClient} subclass. It will be called when things happen that impact the rendering of the content, eg, errors or form submissions. You can also intercept URL loading here (via {@link android.webkit.WebViewClient#shouldOverrideUrlLoading(WebView,String) shouldOverrideUrlLoading()}).</li> <li>Modifying the {@link android.webkit.WebSettings}, such as enabling JavaScript with {@link android.webkit.WebSettings#setJavaScriptEnabled(boolean) setJavaScriptEnabled()}. </li> <li>Injecting Java objects into the WebView using the {@link android.webkit.WebView#addJavascriptInterface} method. This method allows you to inject Java objects into a page's JavaScript context, so that they can be accessed by JavaScript in the page.</li> </ul> <p>Here's a more complicated example, showing error handling, settings, and progress notification:</p> <pre class="prettyprint"> // Let's display the progress in the activity title bar, like the // browser app does. getWindow().requestFeature(Window.FEATURE_PROGRESS); webview.getSettings().setJavaScriptEnabled(true); final Activity activity = this; webview.setWebChromeClient(new WebChromeClient() { public void onProgressChanged(WebView view, int progress) { // Activities and WebViews measure progress with different scales. // The progress meter will automatically disappear when we reach 100% activity.setProgress(progress * 1000); } }); webview.setWebViewClient(new WebViewClient() { public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { Toast.makeText(activity, "Oh no! " + description, Toast.LENGTH_SHORT).show(); } }); webview.loadUrl("http://developer.android.com/"); </pre> <h3>Zoom</h3> <p>To enable the built-in zoom, set {@link #getSettings() android.webkit.WebSettings}.{@link android.webkit.WebSettings#setBuiltInZoomControls(boolean)} (introduced in API level {@link android.os.Build.VERSION_CODES#CUPCAKE}).</p> <p>NOTE: Using zoom if either the height or width is set to {@link android.view.ViewGroup.LayoutParams#WRAP_CONTENT} may lead to undefined behavior and should be avoided.</p> <h3>Cookie and window management</h3> <p>For obvious security reasons, your application has its own cache, cookie store etc.—it does not share the Browser application's data. </p> <p>By default, requests by the HTML to open new windows are ignored. This is true whether they be opened by JavaScript or by the target attribute on a link. You can customize your {@link android.webkit.WebChromeClient} to provide your own behaviour for opening multiple windows, and render them in whatever manner you want.</p> <p>The standard behavior for an Activity is to be destroyed and recreated when the device orientation or any other configuration changes. This will cause the WebView to reload the current page. If you don't want that, you can set your Activity to handle the {@code orientation} and {@code keyboardHidden} changes, and then just leave the WebView alone. It'll automatically re-orient itself as appropriate. Read <a href="{@docRoot}guide/topics/resources/runtime-changes.html">Handling Runtime Changes</a> for more information about how to handle configuration changes during runtime.</p> <h3>Building web pages to support different screen densities</h3> <p>The screen density of a device is based on the screen resolution. A screen with low density has fewer available pixels per inch, where a screen with high density has more — sometimes significantly more — pixels per inch. The density of a screen is important because, other things being equal, a UI element (such as a button) whose height and width are defined in terms of screen pixels will appear larger on the lower density screen and smaller on the higher density screen. For simplicity, Android collapses all actual screen densities into three generalized densities: high, medium, and low.</p> <p>By default, WebView scales a web page so that it is drawn at a size that matches the default appearance on a medium density screen. So, it applies 1.5x scaling on a high density screen (because its pixels are smaller) and 0.75x scaling on a low density screen (because its pixels are bigger). Starting with API level {@link android.os.Build.VERSION_CODES#ECLAIR}, WebView supports DOM, CSS, and meta tag features to help you (as a web developer) target screens with different screen densities.</p> <p>Here's a summary of the features you can use to handle different screen densities:</p> <ul> <li>The {@code window.devicePixelRatio} DOM property. The value of this property specifies the default scaling factor used for the current device. For example, if the value of {@code window.devicePixelRatio} is "1.0", then the device is considered a medium density (mdpi) device and default scaling is not applied to the web page; if the value is "1.5", then the device is considered a high density device (hdpi) and the page content is scaled 1.5x; if the value is "0.75", then the device is considered a low density device (ldpi) and the content is scaled 0.75x.</li> <li>The {@code -webkit-device-pixel-ratio} CSS media query. Use this to specify the screen densities for which this style sheet is to be used. The corresponding value should be either "0.75", "1", or "1.5", to indicate that the styles are for devices with low density, medium density, or high density screens, respectively. For example: <pre> <link rel="stylesheet" media="screen and (-webkit-device-pixel-ratio:1.5)" href="hdpi.css" /></pre> <p>The {@code hdpi.css} stylesheet is only used for devices with a screen pixel ration of 1.5, which is the high density pixel ratio.</p> </li> </ul> <h3>HTML5 Video support</h3> <p>In order to support inline HTML5 video in your application you need to have hardware acceleration turned on. </p> <h3>Full screen support</h3> <p>In order to support full screen — for video or other HTML content — you need to set a {@link android.webkit.WebChromeClient} and implement both {@link android.webkit.WebChromeClient#onShowCustomView(View, android.webkit.WebChromeClient.CustomViewCallback)} and {@link android.webkit.WebChromeClient#onHideCustomView()}. If the implementation of either of these two methods is missing then the web contents will not be allowed to enter full screen. Optionally you can implement {@link android.webkit.WebChromeClient#getVideoLoadingProgressView()} to customize the View displayed whilst a video is loading. </p> <h3>Layout size</h3> <p> It is recommended to set the WebView layout height to a fixed value or to {@link android.view.ViewGroup.LayoutParams#MATCH_PARENT} instead of using {@link android.view.ViewGroup.LayoutParams#WRAP_CONTENT}. When using {@link android.view.ViewGroup.LayoutParams#MATCH_PARENT} for the height none of the WebView's parents should use a {@link android.view.ViewGroup.LayoutParams#WRAP_CONTENT} layout height since that could result in incorrect sizing of the views. </p> <p>Setting the WebView's height to {@link android.view.ViewGroup.LayoutParams#WRAP_CONTENT} enables the following behaviors: <ul> <li>The HTML body layout height is set to a fixed value. This means that elements with a height relative to the HTML body may not be sized correctly. </li> <li>For applications targetting {@link android.os.Build.VERSION_CODES#KITKAT} and earlier SDKs the HTML viewport meta tag will be ignored in order to preserve backwards compatibility. </li> </ul> </p> <p> Using a layout width of {@link android.view.ViewGroup.LayoutParams#WRAP_CONTENT} is not supported. If such a width is used the WebView will attempt to use the width of the parent instead. </p> */ var WebView = { /** Broadcast Action: Indicates the data reduction proxy setting changed. Sent by the settings app when user changes the data reduction proxy value. This intent will always stay as a hidden API. @hide */ DATA_REDUCTION_PROXY_SETTING_CHANGED : "android.webkit.DATA_REDUCTION_PROXY_SETTING_CHANGED", /** URI scheme for telephone number. */ SCHEME_TEL : "tel:", /** URI scheme for email address. */ SCHEME_MAILTO : "mailto:", /** URI scheme for map address. */ SCHEME_GEO : "geo:0,0?q=", /**Specifies whether the horizontal scrollbar has overlay style. @param {Boolean} overlay true if horizontal scrollbar should have overlay style @param overlay true if horizontal scrollbar should have overlay style */ setHorizontalScrollbarOverlay : function( ) {}, /**Specifies whether the vertical scrollbar has overlay style. @param {Boolean} overlay true if vertical scrollbar should have overlay style @param overlay true if vertical scrollbar should have overlay style */ setVerticalScrollbarOverlay : function( ) {}, /**Gets whether horizontal scrollbar has overlay style. @deprecated This method is now obsolete. @return {Boolean} true */ overlayHorizontalScrollbar : function( ) {}, /**Gets whether vertical scrollbar has overlay style. @deprecated This method is now obsolete. @return {Boolean} false */ overlayVerticalScrollbar : function( ) {}, /**Gets the visible height (in pixels) of the embedded title bar (if any). @deprecated This method is now obsolete. @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ getVisibleTitleHeight : function( ) {}, /**Gets the SSL certificate for the main top-level page or null if there is no certificate (the site is not secure). @return {Object {android.net.http.SslCertificate}} the SSL certificate for the main top-level page */ getCertificate : function( ) {}, /**Sets the SSL certificate for the main top-level page. @deprecated Calling this function has no useful effect, and will be ignored in future releases. */ setCertificate : function( ) {}, /**Sets a username and password pair for the specified host. This data is used by the Webview to autocomplete username and password fields in web forms. Note that this is unrelated to the credentials used for HTTP authentication. @param {String} host the host that required the credentials @param {String} username the username for the given host @param {String} password the password for the given host @see WebViewDatabase#clearUsernamePassword @see WebViewDatabase#hasUsernamePassword @deprecated Saving passwords in WebView will not be supported in future versions. */ savePassword : function( ) {}, /**Stores HTTP authentication credentials for a given host and realm. This method is intended to be used with {@link android.webkit.WebViewClient#onReceivedHttpAuthRequest}. @param {String} host the host to which the credentials apply @param {String} realm the realm to which the credentials apply @param {String} username the username @param {String} password the password @see #getHttpAuthUsernamePassword @see WebViewDatabase#hasHttpAuthUsernamePassword @see WebViewDatabase#clearHttpAuthUsernamePassword */ setHttpAuthUsernamePassword : function( ) {}, /**Retrieves HTTP authentication credentials for a given host and realm. This method is intended to be used with {@link android.webkit.WebViewClient#onReceivedHttpAuthRequest}. @param {String} host the host to which the credentials apply @param {String} realm the realm to which the credentials apply @return {String} the credentials as a String array, if found. The first element is the username and the second element is the password. Null if no credentials are found. @see #setHttpAuthUsernamePassword @see WebViewDatabase#hasHttpAuthUsernamePassword @see WebViewDatabase#clearHttpAuthUsernamePassword */ getHttpAuthUsernamePassword : function( ) {}, /**Destroys the internal state of this WebView. This method should be called after this WebView has been removed from the view system. No other methods may be called on this WebView after destroy. */ destroy : function( ) {}, /**Enables platform notifications of data state and proxy changes. Notifications are enabled by default. @deprecated This method is now obsolete. @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ enablePlatformNotifications : function( ) {}, /**Disables platform notifications of data state and proxy changes. Notifications are enabled by default. @deprecated This method is now obsolete. @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ disablePlatformNotifications : function( ) {}, /**Used only by internal tests to free up memory. @hide */ freeMemoryForTests : function( ) {}, /**Informs WebView of the network state. This is used to set the JavaScript property window.navigator.isOnline and generates the online/offline event as specified in HTML5, sec. 5.7.7 @param {Boolean} networkUp a boolean indicating if network is available */ setNetworkAvailable : function( ) {}, /**Saves the state of this WebView used in {@link android.app.Activity#onSaveInstanceState}. Please note that this method no longer stores the display data for this WebView. The previous behavior could potentially leak files if {@link #restoreState} was never called. @param {Object {Bundle}} outState the Bundle to store this WebView's state @return {Object {android.webkit.WebBackForwardList}} the same copy of the back/forward list used to save the state. If saveState fails, the returned list will be null. */ saveState : function( ) {}, /**Saves the current display data to the Bundle given. Used in conjunction with {@link #saveState}. @param {Object {Bundle}} b a Bundle to store the display data @param {Object {File}} dest the file to store the serialized picture data. Will be overwritten with this WebView's picture data. @return {Boolean} true if the picture was successfully saved @deprecated This method is now obsolete. @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ savePicture : function( ) {}, /**Restores the display data that was saved in {@link #savePicture}. Used in conjunction with {@link #restoreState}. Note that this will not work if this WebView is hardware accelerated. @param {Object {Bundle}} b a Bundle containing the saved display data @param {Object {File}} src the file where the picture data was stored @return {Boolean} true if the picture was successfully restored @deprecated This method is now obsolete. @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ restorePicture : function( ) {}, /**Restores the state of this WebView from the given Bundle. This method is intended for use in {@link android.app.Activity#onRestoreInstanceState} and should be called to restore the state of this WebView. If it is called after this WebView has had a chance to build state (load pages, create a back/forward list, etc.) there may be undesirable side-effects. Please note that this method no longer restores the display data for this WebView. @param {Object {Bundle}} inState the incoming Bundle of state @return {Object {android.webkit.WebBackForwardList}} the restored back/forward list or null if restoreState failed */ restoreState : function( ) {}, /**Loads the given URL with the specified additional HTTP headers. @param {String} url the URL of the resource to load @param {Object {java.util.Map}} additionalHttpHeaders the additional headers to be used in the HTTP request for this URL, specified as a map from name to value. Note that if this map contains any of the headers that are set by default by this WebView, such as those controlling caching, accept types or the User-Agent, their values may be overriden by this WebView's defaults. */ loadUrl : function( ) {}, /**Loads the given URL. @param {String} url the URL of the resource to load */ loadUrl : function( ) {}, /**Loads the URL with postData using "POST" method into this WebView. If url is not a network URL, it will be loaded with {@link #loadUrl}(String) instead, ignoring the postData param. @param {String} url the URL of the resource to load @param {Object {byte[]}} postData the data will be passed to "POST" request, which must be be "application/x-www-form-urlencoded" encoded. */ postUrl : function( ) {}, /**Loads the given data into this WebView using a 'data' scheme URL. <p> Note that JavaScript's same origin policy means that script running in a page loaded using this method will be unable to access content loaded using any scheme other than 'data', including 'http(s)'. To avoid this restriction, use {@link #loadDataWithBaseURL(String,String,String,String,String) loadDataWithBaseURL()} with an appropriate base URL. <p> The 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'. For all other values of the parameter, including 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. For example, '#', '%', '\', '?' should be replaced by %23, %25, %27, %3f respectively. <p> The 'data' scheme URL formed by this method uses the default US-ASCII charset. If you need need to set a different charset, you should form a 'data' scheme URL which explicitly specifies a charset parameter in the mediatype portion of the URL and call {@link #loadUrl}(String) instead. Note that the charset obtained from the mediatype portion of a data URL always overrides that specified in the HTML or XML document itself. @param {String} data a String of data in the given encoding @param {String} mimeType the MIME type of the data, e.g. 'text/html' @param {String} encoding the encoding of the data */ loadData : function( ) {}, /**Loads the given data into this WebView, using baseUrl as the base URL for the content. The base URL is used both to resolve relative URLs and when applying JavaScript's same origin policy. The historyUrl is used for the history entry. <p> Note that content specified in this way can access local device files (via 'file' scheme URLs) only if baseUrl specifies a scheme other than 'http', 'https', 'ftp', 'ftps', 'about' or 'javascript'. <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. 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. @param {String} baseUrl the URL to use as the page's base URL. If null defaults to 'about:blank'. @param {String} data a String of data in the given encoding @param {String} mimeType the MIMEType of the data, e.g. 'text/html'. If null, defaults to 'text/html'. @param {String} encoding the encoding of the data @param {String} historyUrl the URL to use as the history entry. If null defaults to 'about:blank'. If non-null, this must be a valid URL. */ loadDataWithBaseURL : function( ) {}, /**Asynchronously evaluates JavaScript in the context of the currently displayed page. 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. @param {String} script the JavaScript to execute. @param {Object {android.webkit.ValueCallback}} resultCallback A callback to be invoked when the script execution completes with the result of the execution (if any). May be null if no notificaion of the result is required. */ evaluateJavascript : function( ) {}, /**Saves the current view as a web archive. @param {String} filename the filename where the archive should be placed */ saveWebArchive : function( ) {}, /**Saves the current view as a web archive. @param {String} basename the filename where the archive should be placed @param {Boolean} autoname if false, takes basename to be a file. If true, basename is assumed to be a directory in which a filename will be chosen according to the URL of the current page. @param {Object {android.webkit.ValueCallback}} callback called after the web archive has been saved. The parameter for onReceiveValue will either be the filename under which the file was saved, or null if saving the file failed. */ saveWebArchive : function( ) {}, /**Stops the current load. */ stopLoading : function( ) {}, /**Reloads the current URL. */ reload : function( ) {}, /**Gets whether this WebView has a back history item. @return {Boolean} true iff this WebView has a back history item */ canGoBack : function( ) {}, /**Goes back in the history of this WebView. */ goBack : function( ) {}, /**Gets whether this WebView has a forward history item. @return {Boolean} true iff this Webview has a forward history item */ canGoForward : function( ) {}, /**Goes forward in the history of this WebView. */ goForward : function( ) {}, /**Gets whether the page can go back or forward the given number of steps. @param {Number} steps the negative or positive number of steps to move the history */ canGoBackOrForward : function( ) {}, /**Goes to the history item that is the number of steps away from the current item. Steps is negative if backward and positive if forward. @param {Number} steps the number of steps to take back or forward in the back forward list */ goBackOrForward : function( ) {}, /**Gets whether private browsing is enabled in this WebView. */ isPrivateBrowsingEnabled : function( ) {}, /**Scrolls the contents of this WebView up by half the view size. @param {Boolean} top true to jump to the top of the page @return {Boolean} true if the page was scrolled */ pageUp : function( ) {}, /**Scrolls the contents of this WebView down by half the page size. @param {Boolean} bottom true to jump to bottom of page @return {Boolean} true if the page was scrolled */ pageDown : function( ) {}, /**Posts a {@link android.webkit.WebView.VisualStateCallback}, which will be called when the current state of the WebView is ready to be drawn. <p>Because updates to the the DOM are processed asynchronously, updates to the DOM may not immediately be reflected visually by subsequent {@link android.webkit.WebView#onDraw} invocations. The {@link android.webkit.WebView.VisualStateCallback} provides a mechanism to notify the caller when the contents of the DOM at the current time are ready to be drawn the next time the {@link android.webkit.WebView} draws.</p> <p>The next draw after the callback completes is guaranteed to reflect all the updates to the DOM up to the the point at which the {@link android.webkit.WebView.VisualStateCallback} was posted, but it may also contain updates applied after the callback was posted.</p> <p>The state of the DOM covered by this API includes the following: <ul> <li>primitive HTML elements (div, img, span, etc..)</li> <li>images</li> <li>CSS animations</li> <li>WebGL</li> <li>canvas</li> </ul> It does not include the state of: <ul> <li>the video tag</li> </ul></p> <p>To guarantee that the {@link android.webkit.WebView} will successfully render the first frame after the {@link android.webkit.WebView.VisualStateCallback#onComplete} method has been called a set of conditions must be met: <ul> <li>If the {@link android.webkit.WebView}'s visibility is set to {@link View#VISIBLE VISIBLE} then the {@link android.webkit.WebView} must be attached to the view hierarchy.</li> <li>If the {@link android.webkit.WebView}'s visibility is set to {@link View#INVISIBLE INVISIBLE} then the {@link android.webkit.WebView} must be attached to the view hierarchy and must be made {@link View#VISIBLE VISIBLE} from the {@link android.webkit.WebView.VisualStateCallback#onComplete} method.</li> <li>If the {@link android.webkit.WebView}'s visibility is set to {@link View#GONE GONE} then the {@link android.webkit.WebView} must be attached to the view hierarchy and its {@link AbsoluteLayout.LayoutParams LayoutParams}'s width and height need to be set to fixed values and must be made {@link View#VISIBLE VISIBLE} from the {@link android.webkit.WebView.VisualStateCallback#onComplete} method.</li> </ul></p> <p>When using this API it is also recommended to enable pre-rasterization if the {@link android.webkit.WebView} is offscreen to avoid flickering. See {@link android.webkit.WebSettings#setOffscreenPreRaster} for more details and do consider its caveats.</p> @param {Number} requestId An id that will be returned in the callback to allow callers to match requests with callbacks. @param {Object {WebView.VisualStateCallback}} callback The callback to be invoked. */ postVisualStateCallback : function( ) {}, /**Clears this WebView so that onDraw() will draw nothing but white background, and onMeasure() will return 0 if MeasureSpec is not MeasureSpec.EXACTLY. @deprecated Use WebView.loadUrl("about:blank") to reliably reset the view state and release page resources (including any running JavaScript). */ clearView : function( ) {}, /**Gets a new picture that captures the current contents of this WebView. The picture is of the entire document being displayed, and is not limited to the area currently displayed by this WebView. Also, the picture is a static copy and is unaffected by later changes to the content being displayed. <p> Note that due to internal changes, for API levels between {@link android.os.Build.VERSION_CODES#HONEYCOMB} and {@link android.os.Build.VERSION_CODES#ICE_CREAM_SANDWICH} inclusive, the picture does not include fixed position elements or scrollable divs. <p> Note that from {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} the returned picture should only be drawn into bitmap-backed Canvas - using any other type of Canvas will involve additional conversion at a cost in memory and performance. Also the {@link android.graphics.Picture#createFromStream} and {@link android.graphics.Picture#writeToStream} methods are not supported on the returned object. @deprecated Use {@link #onDraw} to obtain a bitmap snapshot of the WebView, or {@link #saveWebArchive} to save the content to a file. @return {Object {android.graphics.Picture}} a picture that captures the current contents of this WebView */ capturePicture : function( ) {}, /** @deprecated Use {@link #createPrintDocumentAdapter(String)} which requires user to provide a print document name. */ createPrintDocumentAdapter : function( ) {}, /**Creates a PrintDocumentAdapter that provides the content of this Webview for printing. The adapter works by converting the Webview contents to a PDF stream. The Webview cannot be drawn during the conversion process - any such draws are undefined. It is recommended to use a dedicated off screen Webview for the printing. If necessary, an application may temporarily hide a visible WebView by using a custom PrintDocumentAdapter instance wrapped around the object returned and observing the onStart and onFinish methods. See {@link android.print.PrintDocumentAdapter} for more information. @param {String} documentName The user-facing name of the printed document. See {@link android.print.PrintDocumentInfo} */ createPrintDocumentAdapter : function( ) {}, /**Gets the current scale of this WebView. @return {Number} the current scale @deprecated This method is prone to inaccuracy due to race conditions between the web rendering and UI threads; prefer {@link WebViewClient#onScaleChanged}. */ getScale : function( ) {}, /**Sets the initial scale for this WebView. 0 means default. The behavior for the default scale depends on the state of {@link android.webkit.WebSettings#getUseWideViewPort()} and {@link android.webkit.WebSettings#getLoadWithOverviewMode()}. If the content fits into the WebView control by width, then the zoom is set to 100%. For wide content, the behavor depends on the state of {@link android.webkit.WebSettings#getLoadWithOverviewMode()}. If its value is true, the content will be zoomed out to be fit by width into the WebView control, otherwise not. If initial scale is greater than 0, WebView starts with this value as initial scale. Please note that unlike the scale properties in the viewport meta tag, this method doesn't take the screen density into account. @param {Number} scaleInPercent the initial scale in percent */ setInitialScale : function( ) {}, /**Invokes the graphical zoom picker widget for this WebView. This will result in the zoom widget appearing on the screen to control the zoom level of this WebView. */ invokeZoomPicker : function( ) {}, /**Gets a HitTestResult based on the current cursor node. If a HTML::a tag is found and the anchor has a non-JavaScript URL, the HitTestResult type is set to SRC_ANCHOR_TYPE and the URL is set in the "extra" field. If the anchor does not have a URL or if it is a JavaScript URL, the type will be UNKNOWN_TYPE and the URL has to be retrieved through {@link #requestFocusNodeHref} asynchronously. If a HTML::img tag is found, the HitTestResult type is set to IMAGE_TYPE and the URL is set in the "extra" field. A type of SRC_IMAGE_ANCHOR_TYPE indicates an anchor with a URL that has an image as a child node. If a phone number is found, the HitTestResult type is set to PHONE_TYPE and the phone number is set in the "extra" field of HitTestResult. If a map address is found, the HitTestResult type is set to GEO_TYPE and the address is set in the "extra" field of HitTestResult. If an email address is found, the HitTestResult type is set to EMAIL_TYPE and the email is set in the "extra" field of HitTestResult. Otherwise, HitTestResult type is set to UNKNOWN_TYPE. */ getHitTestResult : function( ) {}, /**Requests the anchor or image element URL at the last tapped point. If hrefMsg is null, this method returns immediately and does not dispatch hrefMsg to its target. If the tapped point hits an image, an anchor, or an image in an anchor, the message associates strings in named keys in its data. The value paired with the key may be an empty string. @param {Object {Message}} hrefMsg the message to be dispatched with the result of the request. The message data contains three keys. "url" returns the anchor's href attribute. "title" returns the anchor's text. "src" returns the image's src attribute. */ requestFocusNodeHref : function( ) {}, /**Requests the URL of the image last touched by the user. msg will be sent to its target with a String representing the URL as its object. @param {Object {Message}} msg the message to be dispatched with the result of the request as the data member with "url" as key. The result can be null. */ requestImageRef : function( ) {}, /**Gets the URL for the current page. This is not always the same as the URL passed to WebViewClient.onPageStarted because although the load for that URL has begun, the current page may not have changed. @return {String} the URL for the current page */ getUrl : function( ) {}, /**Gets the original URL for the current page. This is not always the same as the URL passed to WebViewClient.onPageStarted because although the load for that URL has begun, the current page may not have changed. Also, there may have been redirects resulting in a different URL to that originally requested. @return {String} the URL that was originally requested for the current page */ getOriginalUrl : function( ) {}, /**Gets the title for the current page. This is the title of the current page until WebViewClient.onReceivedTitle is called. @return {String} the title for the current page */ getTitle : function( ) {}, /**Gets the favicon for the current page. This is the favicon of the current page until WebViewClient.onReceivedIcon is called. @return {Object {android.graphics.Bitmap}} the favicon for the current page */ getFavicon : function( ) {}, /**Gets the touch icon URL for the apple-touch-icon <link> element, or a URL on this site's server pointing to the standard location of a touch icon. @hide */ getTouchIconUrl : function( ) {}, /**Gets the progress for the current page. @return {Number} the progress for the current page between 0 and 100 */ getProgress : function( ) {}, /**Gets the height of the HTML content. @return {Number} the height of the HTML content */ getContentHeight : function( ) {}, /**Gets the width of the HTML content. @return {Number} the width of the HTML content @hide */ getContentWidth : function( ) {}, /**Pauses all layout, parsing, and JavaScript timers for all WebViews. This is a global requests, not restricted to just this WebView. This can be useful if the application has been paused. */ pauseTimers : function( ) {}, /**Resumes all layout, parsing, and JavaScript timers for all WebViews. This will resume dispatching all timers. */ resumeTimers : function( ) {}, /**Pauses any extra processing associated with this WebView and its associated DOM, plugins, JavaScript etc. For example, if this WebView is taken offscreen, this could be called to reduce unnecessary CPU or network traffic. When this WebView is again "active", call onResume(). Note that this differs from pauseTimers(), which affects all WebViews. */ onPause : function( ) {}, /**Resumes a WebView after a previous call to onPause(). */ onResume : function( ) {}, /**Gets whether this WebView is paused, meaning onPause() was called. Calling onResume() sets the paused state back to false. @hide */ isPaused : function( ) {}, /**Informs this WebView that memory is low so that it can free any available memory. @deprecated Memory caches are automatically dropped when no longer needed, and in response to system memory pressure. */ freeMemory : function( ) {}, /**Clears the resource cache. Note that the cache is per-application, so this will clear the cache for all WebViews used. @param {Boolean} includeDiskFiles if false, only the RAM cache is cleared */ clearCache : function( ) {}, /**Removes the autocomplete popup from the currently focused form field, if present. Note this only affects the display of the autocomplete popup, it does not remove any saved form data from this WebView's store. To do that, use {@link android.webkit.WebViewDatabase#clearFormData}. */ clearFormData : function( ) {}, /**Tells this WebView to clear its internal back/forward list. */ clearHistory : function( ) {}, /**Clears the SSL preferences table stored in response to proceeding with SSL certificate errors. */ clearSslPreferences : function( ) {}, /**Clears the client certificate preferences stored in response to proceeding/cancelling client cert requests. Note that Webview automatically clears these preferences when it receives a {@link KeyChain#ACTION_STORAGE_CHANGED} intent. The preferences are shared by all the webviews that are created by the embedder application. @param {Object {Runnable}} onCleared A runnable to be invoked when client certs are cleared. The embedder can pass null if not interested in the callback. The runnable will be called in UI thread. */ clearClientCertPreferences : function( ) {}, /**Gets the WebBackForwardList for this WebView. This contains the back/forward list for use in querying each item in the history stack. This is a copy of the private WebBackForwardList so it contains only a snapshot of the current state. Multiple calls to this method may return different objects. The object returned from this method will not be updated to reflect any new state. */ copyBackForwardList : function( ) {}, /**Registers the listener to be notified as find-on-page operations progress. This will replace the current listener. @param {Object {WebView.FindListener}} listener an implementation of {@link FindListener} */ setFindListener : function( ) {}, /**Highlights and scrolls to the next match found by {@link #findAllAsync}, wrapping around page boundaries as necessary. Notifies any registered {@link android.webkit.WebView.FindListener}. If {@link #findAllAsync}(String) has not been called yet, or if {@link #clearMatches} has been called since the last find operation, this function does nothing. @param {Boolean} forward the direction to search @see #setFindListener */ findNext : function( ) {}, /**Finds all instances of find on the page and highlights them. Notifies any registered {@link android.webkit.WebView.FindListener}. @param {String} find the string to find @return {Number} the number of occurances of the String "find" that were found @deprecated {@link #findAllAsync} is preferred. @see #setFindListener */ findAll : function( ) {}, /**Finds all instances of find on the page and highlights them, asynchronously. Notifies any registered {@link android.webkit.WebView.FindListener}. Successive calls to this will cancel any pending searches. @param {String} find the string to find. @see #setFindListener */ findAllAsync : function( ) {}, /**Starts an ActionMode for finding text in this WebView. Only works if this WebView is attached to the view system. @param {String} text if non-null, will be the initial text to search for. Otherwise, the last String searched for in this WebView will be used to start. @param {Boolean} showIme if true, show the IME, assuming the user will begin typing. If false and text is non-null, perform a find all. @return {Boolean} true if the find dialog is shown, false otherwise @deprecated This method does not work reliably on all Android versions; implementing a custom find dialog using WebView.findAllAsync() provides a more robust solution. */ showFindDialog : function( ) {}, /**Gets the first substring consisting of the address of a physical location. Currently, only addresses in the United States are detected, and consist of: <ul> <li>a house number</li> <li>a street name</li> <li>a street type (Road, Circle, etc), either spelled out or abbreviated</li> <li>a city name</li> <li>a state or territory, either spelled out or two-letter abbr</li> <li>an optional 5 digit or 9 digit zip code</li> </ul> All names must be correctly capitalized, and the zip code, if present, must be valid for the state. The street type must be a standard USPS spelling or abbreviation. The state or territory must also be spelled or abbreviated using USPS standards. The house number may not exceed five digits. @param {String} addr the string to search for addresses @return {String} the address, or if no address is found, null */ findAddress : function( ) {}, /**For apps targeting the L release, WebView has a new default behavior that reduces memory footprint and increases performance by intelligently choosing the portion of the HTML document that needs to be drawn. These optimizations are transparent to the developers. However, under certain circumstances, an App developer may want to disable them: <ol> <li>When an app uses {@link #onDraw} to do own drawing and accesses portions of the page that is way outside the visible portion of the page.</li> <li>When an app uses {@link #capturePicture} to capture a very large HTML document. Note that capturePicture is a deprecated API.</li> </ol> Enabling drawing the entire HTML document has a significant performance cost. This method should be called before any WebViews are created. */ enableSlowWholeDocumentDraw : function( ) {}, /**Clears the highlighting surrounding text matches created by {@link #findAllAsync}. */ clearMatches : function( ) {}, /**Queries the document to see if it contains any image references. The message object will be dispatched with arg1 being set to 1 if images were found and 0 if the document does not reference any images. @param {Object {Message}} response the message that will be dispatched with the result */ documentHasImages : function( ) {}, /**Sets the WebViewClient that will receive various notifications and requests. This will replace the current handler. @param {Object {WebViewClient}} client an implementation of WebViewClient */ setWebViewClient : function( ) {}, /**Registers the interface to be used when content can not be handled by the rendering engine, and should be downloaded instead. This will replace the current handler. @param {Object {DownloadListener}} listener an implementation of DownloadListener */ setDownloadListener : function( ) {}, /**Sets the chrome handler. This is an implementation of WebChromeClient for use in handling JavaScript dialogs, favicons, titles, and the progress. This will replace the current handler. @param {Object {WebChromeClient}} client an implementation of WebChromeClient */ setWebChromeClient : function( ) {}, /**Sets the Picture listener. This is an interface used to receive notifications of a new Picture. @param {Object {WebView.PictureListener}} listener an implementation of WebView.PictureListener @deprecated This method is now obsolete. */ setPictureListener : function( ) {}, /**Injects the supplied Java object into this WebView. The object is injected into the JavaScript context of the main frame, using the supplied name. This allows the Java object's methods to be accessed from JavaScript. For applications targeted to API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} and above, only public methods that are annotated with {@link android.webkit.JavascriptInterface} can be accessed from JavaScript. For applications targeted to API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN} or below, all public methods (including the inherited ones) can be accessed, see the important security note below for implications. <p> Note that injected objects will not appear in JavaScript until the page is next (re)loaded. For example: <pre> class JsObject { {@literal @}JavascriptInterface public String toString() { return "injectedObject"; } } webView.addJavascriptInterface(new JsObject(), "injectedObject"); webView.loadData("<!DOCTYPE html><title></title>", "text/html", null); webView.loadUrl("javascript:alert(injectedObject.toString())");</pre> <p> <strong>IMPORTANT:</strong> <ul> <li> This method can be used to allow JavaScript to control the host application. This is a powerful feature, but also presents a security risk for apps targeting {@link android.os.Build.VERSION_CODES#JELLY_BEAN} or earlier. Apps that target a version later than {@link android.os.Build.VERSION_CODES#JELLY_BEAN} are still vulnerable if the app runs on a device running Android earlier than 4.2. The most secure way to use this method is to target {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} and to ensure the method is called only when running on Android 4.2 or later. With these older versions, JavaScript could use reflection to access an injected object's public fields. Use of this method in a WebView containing untrusted content could allow an attacker to manipulate the host application in unintended ways, executing Java code with the permissions of the host application. Use extreme care when using this method in a WebView which could contain untrusted content.</li> <li> JavaScript interacts with Java object on a private, background thread of this WebView. Care is therefore required to maintain thread safety. </li> <li> The Java object's fields are not accessible.</li> <li> For applications targeted to API level {@link android.os.Build.VERSION_CODES#LOLLIPOP} and above, methods of injected Java objects are enumerable from JavaScript.</li> </ul> @param {Object {Object}} object the Java object to inject into this WebView's JavaScript context. Null values are ignored. @param {String} name the name used to expose the object in JavaScript */ addJavascriptInterface : function( ) {}, /**Removes a previously injected Java object from this WebView. Note that the removal will not be reflected in JavaScript until the page is next (re)loaded. See {@link #addJavascriptInterface}. @param {String} name the name used to expose the object in JavaScript */ removeJavascriptInterface : function( ) {}, /**Creates a message channel to communicate with JS and returns the message ports that represent the endpoints of this message channel. The HTML5 message channel functionality is described <a href="https://html.spec.whatwg.org/multipage/comms.html#messagechannel">here </a> The returned message channels are entangled and already in started state. @return {Object {android.webkit.WebMessagePort}} the two message ports that form the message channel. */ createWebMessageChannel : function( ) {}, /**Post a message to main frame. The embedded application can restrict the messages to a certain target origin. See <a href="https://html.spec.whatwg.org/multipage/comms.html#posting-messages"> HTML5 spec</a> for how target origin can be used. @param {Object {WebMessage}} message the WebMessage @param {Object {Uri}} targetOrigin the target origin. This is the origin of the page that is intended to receive the message. For best security practices, the user should not specify a wildcard (*) when specifying the origin. */ postWebMessage : function( ) {}, /**Gets the WebSettings object used to control the settings for this WebView. @return {Object {android.webkit.WebSettings}} a WebSettings object that can be used to control this WebView's settings */ getSettings : function( ) {}, /**Enables debugging of web contents (HTML / CSS / JavaScript) loaded into any WebViews of this application. This flag can be enabled in order to facilitate debugging of web layouts and JavaScript code running inside WebViews. Please refer to WebView documentation for the debugging guide. The default is false. @param {Boolean} enabled whether to enable web contents debugging */ setWebContentsDebuggingEnabled : function( ) {}, /**Gets the list of currently loaded plugins. @return {Object {android.webkit.PluginList}} the list of currently loaded plugins @deprecated This was used for Gears, which has been deprecated. @hide */ getPluginList : function( ) {}, /** @deprecated This was used for Gears, which has been deprecated. @hide */ refreshPlugins : function( ) {}, /**Puts this WebView into text selection mode. Do not rely on this functionality; it will be deprecated in the future. @deprecated This method is now obsolete. @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ emulateShiftHeld : function( ) {}, /** @deprecated WebView no longer needs to implement ViewGroup.OnHierarchyChangeListener. This method does nothing now. */ onChildViewAdded : function( ) {}, /** @deprecated WebView no longer needs to implement ViewGroup.OnHierarchyChangeListener. This method does nothing now. */ onChildViewRemoved : function( ) {}, /** @deprecated WebView should not have implemented ViewTreeObserver.OnGlobalFocusChangeListener. This method does nothing now. */ onGlobalFocusChanged : function( ) {}, /** @deprecated Only the default case, true, will be supported in a future version. */ setMapTrackballToArrowKeys : function( ) {}, /** */ flingScroll : function( ) {}, /**Gets the zoom controls for this WebView, as a separate View. The caller is responsible for inserting this View into the layout hierarchy. <p/> API level {@link android.os.Build.VERSION_CODES#CUPCAKE} introduced built-in zoom mechanisms for the WebView, as opposed to these separate zoom controls. The built-in mechanisms are preferred and can be enabled using {@link android.webkit.WebSettings#setBuiltInZoomControls}. @deprecated the built-in zoom mechanisms are preferred @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN} */ getZoomControls : function( ) {}, /**Gets whether this WebView can be zoomed in. @return {Boolean} true if this WebView can be zoomed in @deprecated This method is prone to inaccuracy due to race conditions between the web rendering and UI threads; prefer {@link WebViewClient#onScaleChanged}. */ canZoomIn : function( ) {}, /**Gets whether this WebView can be zoomed out. @return {Boolean} true if this WebView can be zoomed out @deprecated This method is prone to inaccuracy due to race conditions between the web rendering and UI threads; prefer {@link WebViewClient#onScaleChanged}. */ canZoomOut : function( ) {}, /**Performs a zoom operation in this WebView. @param {Number} zoomFactor the zoom factor to apply. The zoom factor will be clamped to the Webview's zoom limits. This value must be in the range 0.01 to 100.0 inclusive. */ zoomBy : function( ) {}, /**Performs zoom in in this WebView. @return {Boolean} true if zoom in succeeds, false if no zoom changes */ zoomIn : function( ) {}, /**Performs zoom out in this WebView. @return {Boolean} true if zoom out succeeds, false if no zoom changes */ zoomOut : function( ) {}, /** @deprecated This method is now obsolete. @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ debugDump : function( ) {}, /**See {@link ViewDebug.HierarchyHandler#dumpViewHierarchyWithProperties(BufferedWriter, int)} @hide */ dumpViewHierarchyWithProperties : function( ) {}, /**See {@link ViewDebug.HierarchyHandler#findHierarchyView(String, int)} @hide */ findHierarchyView : function( ) {}, /**Gets the WebViewProvider. Used by providers to obtain the underlying implementation, e.g. when the appliction responds to WebViewClient.onCreateWindow() request. @hide WebViewProvider is not public API. */ getWebViewProvider : function( ) {}, /** */ setLayoutParams : function( ) {}, /** */ setOverScrollMode : function( ) {}, /** */ setScrollBarStyle : function( ) {}, /** */ computeScroll : function( ) {}, /** */ onHoverEvent : function( ) {}, /** */ onTouchEvent : function( ) {}, /** */ onGenericMotionEvent : function( ) {}, /** */ onTrackballEvent : function( ) {}, /** */ onKeyDown : function( ) {}, /** */ onKeyUp : function( ) {}, /** */ onKeyMultiple : function( ) {}, /** */ getAccessibilityNodeProvider : function( ) {}, /** */ shouldDelayChildPressedState : function( ) {}, /** */ getAccessibilityClassName : function( ) {}, /** */ onProvideVirtualStructure : function( ) {}, /** @hide */ onInitializeAccessibilityNodeInfoInternal : function( ) {}, /** @hide */ onInitializeAccessibilityEventInternal : function( ) {}, /** @hide */ performAccessibilityActionInternal : function( ) {}, /** */ performLongClick : function( ) {}, /** */ onCreateInputConnection : function( ) {}, /** */ onWindowFocusChanged : function( ) {}, /** */ dispatchKeyEvent : function( ) {}, /** */ requestFocus : function( ) {}, /** */ requestChildRectangleOnScreen : function( ) {}, /** */ setBackgroundColor : function( ) {}, /** */ setLayerType : function( ) {}, /** */ onStartTemporaryDetach : function( ) {}, /** */ onFinishTemporaryDetach : function( ) {}, };