public class

WebSettings

extends Object
java.lang.Object
   ↳ com.tencent.smtt.sdk.WebSettings

Summary

Nested Classes
enum WebSettings.LayoutAlgorithm Enum for controlling the layout of html. 
Constants
int LOAD_CACHE_ELSE_NETWORK Use cache if content is there, even if expired (eg, history nav) If it is not in the cache, load from network.
int LOAD_CACHE_ONLY Don't use the network, load from cache only.
int LOAD_DEFAULT Default cache usage pattern Use with setCacheMode(int).
int LOAD_NORMAL Normal cache usage pattern Use with setCacheMode(int).
int LOAD_NO_CACHE Don't use the cache, load from network Use with setCacheMode(int).
Public Methods
boolean getAllowContentAccess()
Gets whether this WebView supports content URL access.
boolean getAllowFileAccess()
Gets whether this WebView supports file access.
synchronized boolean getBlockNetworkImage()
Gets whether the WebView does not load image resources from the network.
synchronized boolean getBlockNetworkLoads()
Gets whether the WebView does not load any resources from the network.
boolean getBuiltInZoomControls()
Gets whether the zoom mechanisms built into WebView are being used.
int getCacheMode()
Gets the current setting for overriding the cache mode.
synchronized String getCursiveFontFamily()
Gets the cursive font family name.
synchronized boolean getDatabaseEnabled()
Gets whether the database storage API is enabled.
synchronized int getDefaultFixedFontSize()
Gets the default fixed font size.
synchronized int getDefaultFontSize()
Gets the default font size.
synchronized String getDefaultTextEncodingName()
Gets the default text encoding name.
static String getDefaultUserAgent(Context context)
Returns the default User-Agent used by a WebView.
boolean getDisplayZoomControls()
Gets whether the WebView displays on-screen zoom controls when using the built-in zoom mechanisms.
synchronized boolean getDomStorageEnabled()
Gets whether the DOM Storage APIs are enabled.
synchronized String getFantasyFontFamily()
Gets the fantasy font family name.
synchronized String getFixedFontFamily()
Gets the fixed font family name.
synchronized boolean getJavaScriptCanOpenWindowsAutomatically()
Gets whether JavaScript can open windows automatically.
synchronized boolean getJavaScriptEnabled()
Gets whether JavaScript is enabled.
synchronized WebSettings.LayoutAlgorithm getLayoutAlgorithm()
Gets the current layout algorithm.
boolean getLoadWithOverviewMode()
Gets whether this WebView loads pages in overview mode.
synchronized boolean getLoadsImagesAutomatically()
Gets whether the WebView loads image resources.
boolean getMediaPlaybackRequiresUserGesture()
Gets whether the WebView requires a user gesture to play media.
synchronized int getMinimumFontSize()
Gets the minimum font size.
synchronized int getMinimumLogicalFontSize()
Gets the minimum logical font size.
synchronized int getMixedContentMode()
Gets the current behavior of the WebView with regard to loading insecure content from a secure origin.
boolean getSafeBrowsingEnabled()
Gets whether Safe Browsing is enabled.
synchronized String getSansSerifFontFamily()
Gets the sans-serif font family name.
boolean getSaveFormData()
Gets whether the WebView saves form data.
synchronized String getSerifFontFamily()
Gets the serif font family name.
synchronized String getStandardFontFamily()
Gets the standard font family name.
synchronized int getTextZoom()
Gets the text zoom of the page in percent.
synchronized boolean getUseWideViewPort()
Gets whether the WebView supports the "viewport" HTML meta tag or will use a wide viewport.
String getUserAgentString()
Gets the WebView's user-agent string.
void setAllowContentAccess(boolean allow)
Enables or disables content URL access within WebView.
void setAllowFileAccess(boolean allow)
Enables or disables file access within WebView.
void setAllowFileAccessFromFileURLs(boolean isAllow)
Sets whether JavaScript running in the context of a file scheme URL should be allowed to access content from other file scheme URLs.
void setAllowUniversalAccessFromFileURLs(boolean isAllow)
Sets whether JavaScript running in the context of a file scheme URL should be allowed to access content from any origin.
void setAppCacheEnabled(boolean flag)
Sets whether the Application Caches API should be enabled.
void setAppCachePath(String appCachePath)
Sets the path to the Application Caches files.
void setBlockNetworkImage(boolean flag)
Sets whether the WebView should not load image resources from the network (resources accessed via http and https URI schemes).
synchronized void setBlockNetworkLoads(boolean flag)
Sets whether the WebView should not load resources from the network.
void setBuiltInZoomControls(boolean enabled)
Sets whether the WebView should use its built-in zoom mechanisms.
void setCacheMode(int mode)
Overrides the way the cache is used.
synchronized void setCursiveFontFamily(String font)
Sets the cursive font family name.
void setDatabaseEnabled(boolean flag)
Sets whether the database storage API is enabled.
synchronized void setDefaultFixedFontSize(int size)
Sets the default fixed font size.
synchronized void setDefaultFontSize(int size)
Sets the default font size.
synchronized void setDefaultTextEncodingName(String encoding)
Sets the default text encoding name to use when decoding html pages.
void setDisplayZoomControls(boolean enabled)
Sets whether the WebView should display on-screen zoom controls when using the built-in zoom mechanisms.
void setDomStorageEnabled(boolean flag)
Sets whether the DOM storage API is enabled.
synchronized void setFantasyFontFamily(String font)
Sets the fantasy font family name.
synchronized void setFixedFontFamily(String font)
Sets the fixed font family name.
void setGeolocationEnabled(boolean flag)
Sets whether Geolocation is enabled.
synchronized void setJavaScriptCanOpenWindowsAutomatically(boolean flag)
Tells JavaScript to open windows automatically.
void setJavaScriptEnabled(boolean flag)
Tells the WebView to enable JavaScript execution.
void setLayoutAlgorithm(WebSettings.LayoutAlgorithm l)
Sets the underlying layout algorithm.
void setLoadWithOverviewMode(boolean overview)
Sets whether the WebView loads pages in overview mode, that is, zooms out the content to fit on screen by width.
void setLoadsImagesAutomatically(boolean flag)
Sets whether the WebView should load image resources.
void setMediaPlaybackRequiresUserGesture(boolean require)
Sets whether the WebView requires a user gesture to play media.
synchronized void setMinimumFontSize(int size)
Sets the minimum font size.
synchronized void setMinimumLogicalFontSize(int size)
Sets the minimum logical font size.
void setMixedContentMode(int mode)
Configures the WebView's behavior when a secure origin attempts to load a resource from an insecure origin.
void setNeedInitialFocus(boolean flag)
Tells the WebView whether it needs to set a node to have focus when WebView#requestFocus(int, android.graphics.Rect) is called.
void setSafeBrowsingEnabled(boolean enabled)
Sets whether Safe Browsing is enabled.
synchronized void setSansSerifFontFamily(String font)
Sets the sans-serif font family name.
void setSaveFormData(boolean save)
Sets whether the WebView should save form data.
void setSavePassword(boolean save)
This method is deprecated. Saving passwords in WebView will not be supported in future versions.
synchronized void setSerifFontFamily(String font)
Sets the serif font family name.
synchronized void setStandardFontFamily(String font)
Sets the standard font family name.
void setSupportMultipleWindows(boolean support)
Sets whether the WebView whether supports multiple windows.
void setSupportZoom(boolean support)
Sets whether the WebView should support zooming using its on-screen zoom controls and gestures.
synchronized void setTextZoom(int textZoom)
Sets the text zoom of the page in percent.
void setUseWideViewPort(boolean use)
Sets whether the WebView should enable support for the "viewport" HTML meta tag or should use a wide viewport.
void setUserAgent(String ua)
Sets the WebView's user-agent string.
void setUserAgentString(String ua)
Sets the WebView's user-agent string.
synchronized boolean supportMultipleWindows()
Gets whether the WebView supports multiple windows.
boolean supportZoom()
Gets whether the WebView supports zoom.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int LOAD_CACHE_ELSE_NETWORK

Use cache if content is there, even if expired (eg, history nav) If it is not in the cache, load from network. Use with setCacheMode(int).

Constant Value: 1 (0x00000001)

public static final int LOAD_CACHE_ONLY

Don't use the network, load from cache only. Use with setCacheMode(int).

Constant Value: 3 (0x00000003)

public static final int LOAD_DEFAULT

Default cache usage pattern Use with setCacheMode(int).

Constant Value: -1 (0xffffffff)

public static final int LOAD_NORMAL

Normal cache usage pattern Use with setCacheMode(int).

Constant Value: 0 (0x00000000)

public static final int LOAD_NO_CACHE

Don't use the cache, load from network Use with setCacheMode(int).

Constant Value: 2 (0x00000002)

Public Methods

public boolean getAllowContentAccess ()

Gets whether this WebView supports content URL access.

public boolean getAllowFileAccess ()

Gets whether this WebView supports file access.

public synchronized boolean getBlockNetworkImage ()

Gets whether the WebView does not load image resources from the network.

Returns
  • true if the WebView does not load image resources from the network

public synchronized boolean getBlockNetworkLoads ()

Gets whether the WebView does not load any resources from the network.

Returns
  • true if the WebView does not load any resources from the network

public boolean getBuiltInZoomControls ()

Gets whether the zoom mechanisms built into WebView are being used.

Returns
  • true if the zoom mechanisms built into WebView are being used

public int getCacheMode ()

Gets the current setting for overriding the cache mode.

Returns
  • the current setting for overriding the cache mode

public synchronized String getCursiveFontFamily ()

Gets the cursive font family name.

Returns
  • the cursive font family name as a string

public synchronized boolean getDatabaseEnabled ()

Gets whether the database storage API is enabled.

Returns
  • true if the database storage API is enabled

public synchronized int getDefaultFixedFontSize ()

Gets the default fixed font size.

Returns
  • a non-negative integer between 1 and 72

public synchronized int getDefaultFontSize ()

Gets the default font size.

Returns
  • a non-negative integer between 1 and 72

public synchronized String getDefaultTextEncodingName ()

Gets the default text encoding name.

Returns
  • the default text encoding name as a string

public static String getDefaultUserAgent (Context context)

Returns the default User-Agent used by a WebView. An instance of WebView could use a different User-Agent if a call is made to setUserAgentString(String).

Parameters
context a Context object used to access application assets

public boolean getDisplayZoomControls ()

Gets whether the WebView displays on-screen zoom controls when using the built-in zoom mechanisms.

Returns
  • true if the WebView displays on-screen zoom controls when using the built-in zoom mechanisms

public synchronized boolean getDomStorageEnabled ()

Gets whether the DOM Storage APIs are enabled.

Returns
  • true if the DOM Storage APIs are enabled

public synchronized String getFantasyFontFamily ()

Gets the fantasy font family name.

Returns
  • the fantasy font family name as a string

public synchronized String getFixedFontFamily ()

Gets the fixed font family name.

Returns
  • the fixed font family name as a string

public synchronized boolean getJavaScriptCanOpenWindowsAutomatically ()

Gets whether JavaScript can open windows automatically.

Returns
  • true if JavaScript can open windows automatically during window.open()

public synchronized boolean getJavaScriptEnabled ()

Gets whether JavaScript is enabled.

Returns
  • true if JavaScript is enabled

public synchronized WebSettings.LayoutAlgorithm getLayoutAlgorithm ()

Gets the current layout algorithm.

Returns

public boolean getLoadWithOverviewMode ()

Gets whether this WebView loads pages in overview mode.

Returns
  • whether this WebView loads pages in overview mode

public synchronized boolean getLoadsImagesAutomatically ()

Gets whether the WebView loads image resources. This includes images embedded using the data URI scheme.

Returns
  • true if the WebView loads image resources

public boolean getMediaPlaybackRequiresUserGesture ()

Gets whether the WebView requires a user gesture to play media.

Returns
  • true if the WebView requires a user gesture to play media

public synchronized int getMinimumFontSize ()

Gets the minimum font size.

Returns
  • a non-negative integer between 1 and 72

public synchronized int getMinimumLogicalFontSize ()

Gets the minimum logical font size.

Returns
  • a non-negative integer between 1 and 72

public synchronized int getMixedContentMode ()

Gets the current behavior of the WebView with regard to loading insecure content from a secure origin.

Returns
  • The current setting, one of MIXED_CONTENT_NEVER_ALLOW(1), MIXED_CONTENT_ALWAYS_ALLOW(0) or MIXED_CONTENT_COMPATIBILITY_MODE(2).

public boolean getSafeBrowsingEnabled ()

Gets whether Safe Browsing is enabled. See setSafeBrowsingEnabled(boolean).

Returns
  • true if Safe Browsing is enabled and false otherwise.

public synchronized String getSansSerifFontFamily ()

Gets the sans-serif font family name.

Returns
  • the sans-serif font family name as a string

public boolean getSaveFormData ()

Gets whether the WebView saves form data.

Returns
  • whether the WebView saves form data

public synchronized String getSerifFontFamily ()

Gets the serif font family name. The default is "serif".

Returns
  • the serif font family name as a string

public synchronized String getStandardFontFamily ()

Gets the standard font family name.

Returns
  • the standard font family name as a string

public synchronized int getTextZoom ()

Gets the text zoom of the page in percent.

Returns
  • the text zoom of the page in percent
See Also

public synchronized boolean getUseWideViewPort ()

Gets whether the WebView supports the "viewport" HTML meta tag or will use a wide viewport.

Returns
  • true if the WebView supports the viewport meta tag

public String getUserAgentString ()

Gets the WebView's user-agent string.

Returns
  • the WebView's user-agent string

public void setAllowContentAccess (boolean allow)

Enables or disables content URL access within WebView. Content URL access allows WebView to load content from a content provider installed in the system. The default is enabled.

public void setAllowFileAccess (boolean allow)

Enables or disables file access within WebView. File access is enabled by default. Note that this enables or disables file system access only. Assets and resources are still accessible using file:///android_asset and file:///android_res.

public void setAllowFileAccessFromFileURLs (boolean isAllow)

Sets whether JavaScript running in the context of a file scheme URL should be allowed to access content from other file scheme URLs. To enable the most restrictive, and therefore secure, policy this setting should be disabled. Note that this setting affects only JavaScript access to file scheme resources. Other access to such resources, for example, from image HTML elements, is unaffected. To prevent possible violation of same domain policy when targeting android.os.Build.VERSION_CODES#ICE_CREAM_SANDWICH_MR1 and earlier, you should explicitly set this value to false.

The default value is true for apps targeting android.os.Build.VERSION_CODES#ICE_CREAM_SANDWICH_MR1 and below, and false when targeting android.os.Build.VERSION_CODES#JELLY_BEAN and above.

Parameters
isAllow whether JavaScript running in the context of a file scheme URL should be allowed to access content from other file scheme URLs

public void setAllowUniversalAccessFromFileURLs (boolean isAllow)

Sets whether JavaScript running in the context of a file scheme URL should be allowed to access content from any origin. This includes access to content from other file scheme URLs. See setAllowFileAccessFromFileURLs(boolean). To enable the most restrictive, and therefore secure policy, this setting should be disabled. Note that this setting affects only JavaScript access to file scheme resources. Other access to such resources, for example, from image HTML elements, is unaffected. To prevent possible violation of same domain policy when targeting android.os.Build.VERSION_CODES#ICE_CREAM_SANDWICH_MR1 and earlier, you should explicitly set this value to false.

The default value is true for apps targeting android.os.Build.VERSION_CODES#ICE_CREAM_SANDWICH_MR1 and below, and false when targeting android.os.Build.VERSION_CODES#JELLY_BEAN and above.

Parameters
isAllow whether JavaScript running in the context of a file scheme URL should be allowed to access content from any origin

public void setAppCacheEnabled (boolean flag)

Sets whether the Application Caches API should be enabled. The default is false. Note that in order for the Application Caches API to be enabled, a valid database path must also be supplied to setAppCachePath(String).

Parameters
flag true if the WebView should enable Application Caches

public void setAppCachePath (String appCachePath)

Sets the path to the Application Caches files. In order for the Application Caches API to be enabled, this method must be called with a path to which the application can write. This method should only be called once: repeated calls are ignored.

Parameters
appCachePath a String path to the directory containing Application Caches files.

public void setBlockNetworkImage (boolean flag)

Sets whether the WebView should not load image resources from the network (resources accessed via http and https URI schemes). Note that this method has no effect unless getLoadsImagesAutomatically() returns true. Also note that disabling all network loads using setBlockNetworkLoads(boolean) will also prevent network images from loading, even if this flag is set to false. When the value of this setting is changed from true to false, network images resources referenced by content currently displayed by the WebView are fetched automatically. The default is false.

Parameters
flag whether the WebView should not load image resources from the network

public synchronized void setBlockNetworkLoads (boolean flag)

Sets whether the WebView should not load resources from the network. Use setBlockNetworkImage(boolean) to only avoid loading image resources. Note that if the value of this setting is changed from true to false, network resources referenced by content currently displayed by the WebView are not fetched until reload() is called. If the application does not have the android.Manifest.permission#INTERNET permission, attempts to set a value of false will cause a ava.lang.SecurityException to be thrown. The default value is false if the application has the android.Manifest.permission#INTERNET permission, otherwise it is true.

Parameters
flag true means block network loads by the WebView. see reload()

public void setBuiltInZoomControls (boolean enabled)

Sets whether the WebView should use its built-in zoom mechanisms. The built-in zoom mechanisms comprise on-screen zoom controls, which are displayed over the WebView's content, and the use of a pinch gesture to control zooming. Whether or not these on-screen controls are displayed can be set with setDisplayZoomControls(boolean). The default is false.

The built-in mechanisms are the only currently supported zoom mechanisms, so it is recommended that this setting is always enabled.

Parameters
enabled whether the WebView should use its built-in zoom mechanisms

public void setCacheMode (int mode)

Overrides the way the cache is used. The way the cache is used is based on the navigation type. For a normal page load, the cache is checked and content is re-validated as needed. When navigating back, content is not revalidated, instead the content is just retrieved from the cache. This method allows the client to override this behavior by specifying one of LOAD_DEFAULT, LOAD_CACHE_ELSE_NETWORK, LOAD_NO_CACHE or LOAD_CACHE_ONLY. The default value is LOAD_DEFAULT.

Parameters
mode the mode to use

public synchronized void setCursiveFontFamily (String font)

Sets the cursive font family name. The default is "cursive".

Parameters
font a font family name

public void setDatabaseEnabled (boolean flag)

Sets whether the database storage API is enabled. The default value is false. This setting is global in effect, across all WebView instances in a process. Note you should only modify this setting prior to making any WebView page load within a given process, as the WebView implementation may ignore changes to this setting after that point.

Parameters
flag true if the WebView should use the database storage API

public synchronized void setDefaultFixedFontSize (int size)

Sets the default fixed font size. The default is 16.

Parameters
size a non-negative integer between 1 and 72. Any number outside the specified range will be pinned.

public synchronized void setDefaultFontSize (int size)

Sets the default font size. The default is 16.

Parameters
size a non-negative integer between 1 and 72. Any number outside the specified range will be pinned.

public synchronized void setDefaultTextEncodingName (String encoding)

Sets the default text encoding name to use when decoding html pages. The default is "UTF-8".

Parameters
encoding the text encoding name

public void setDisplayZoomControls (boolean enabled)

Sets whether the WebView should display on-screen zoom controls when using the built-in zoom mechanisms. See setBuiltInZoomControls(boolean). The default is true.

Parameters
enabled whether the WebView should display on-screen zoom controls

public void setDomStorageEnabled (boolean flag)

Sets whether the DOM storage API is enabled. The default value is false.

Parameters
flag true if the WebView should use the DOM storage API

public synchronized void setFantasyFontFamily (String font)

Sets the fantasy font family name. The default is "fantasy".

Parameters
font a font family name

public synchronized void setFixedFontFamily (String font)

Sets the fixed font family name. The default is "monospace".

Parameters
font a font family name

public void setGeolocationEnabled (boolean flag)

Sets whether Geolocation is enabled. The default is true.

Please note that in order for the Geolocation API to be usable by a page in the WebView, the following requirements must be met:

  • an application must have permission to access the device location, see android.Manifest.permission#ACCESS_COARSE_LOCATION, android.Manifest.permission#ACCESS_FINE_LOCATION;
  • an application must provide an implementation of the onGeolocationPermissionsShowPrompt(String, GeolocationPermissionsCallback) callback to receive notifications that a page is requesting access to location via the JavaScript Geolocation API.

Parameters
flag whether Geolocation should be enabled

public synchronized void setJavaScriptCanOpenWindowsAutomatically (boolean flag)

Tells JavaScript to open windows automatically. This applies to the JavaScript function window.open(). The default is false.

Parameters
flag true if JavaScript can open windows automatically

public void setJavaScriptEnabled (boolean flag)

Tells the WebView to enable JavaScript execution. The default is false.

Parameters
flag true if the WebView should execute JavaScript

public void setLayoutAlgorithm (WebSettings.LayoutAlgorithm l)

Sets the underlying layout algorithm. This will cause a re-layout of the WebView. The default is NARROW_COLUMNS.

Parameters
l the layout algorithm to use, as a WebSettings.LayoutAlgorithm value

public void setLoadWithOverviewMode (boolean overview)

Sets whether the WebView loads pages in overview mode, that is, zooms out the content to fit on screen by width. This setting is taken into account when the content width is greater than the width of the WebView control, for example, when getUseWideViewPort() is enabled. The default is false.

public void setLoadsImagesAutomatically (boolean flag)

Sets whether the WebView should load image resources. Note that this method controls loading of all images, including those embedded using the data URI scheme. Use setBlockNetworkImage(boolean) to control loading only of images specified using network URI schemes. Note that if the value of this setting is changed from false to true, all images resources referenced by content currently displayed by the WebView are loaded automatically. The default is true.

Parameters
flag whether the WebView should load image resources

public void setMediaPlaybackRequiresUserGesture (boolean require)

Sets whether the WebView requires a user gesture to play media. The default is true.

Parameters
require whether the WebView requires a user gesture to play media

public synchronized void setMinimumFontSize (int size)

Sets the minimum font size. The default is 8.

Parameters
size a non-negative integer between 1 and 72. Any number outside the specified range will be pinned.

public synchronized void setMinimumLogicalFontSize (int size)

Sets the minimum logical font size. The default is 8.

Parameters
size a non-negative integer between 1 and 72. Any number outside the specified range will be pinned.

public void setMixedContentMode (int mode)

Configures the WebView's behavior when a secure origin attempts to load a resource from an insecure origin. By default, apps that target android.os.Build.VERSION_CODES#KITKAT or below default to MIXED_CONTENT_ALWAYS_ALLOW(0). Apps targeting android.os.Build.VERSION_CODES#LOLLIPOP default to MIXED_CONTENT_NEVER_ALLOW(1). The preferred and most secure mode of operation for the WebView is MIXED_CONTENT_NEVER_ALLOW(1) and use of MIXED_CONTENT_ALWAYS_ALLOW(0) is strongly discouraged.

Parameters
mode The mixed content mode to use. One of MIXED_CONTENT_NEVER_ALLOW(1), MIXED_CONTENT_ALWAYS_ALLOW(0) or MIXED_CONTENT_COMPATIBILITY_MODE(2).

public void setNeedInitialFocus (boolean flag)

Tells the WebView whether it needs to set a node to have focus when WebView#requestFocus(int, android.graphics.Rect) is called. The default value is true.

Parameters
flag whether the WebView needs to set a node

public void setSafeBrowsingEnabled (boolean enabled)

Sets whether Safe Browsing is enabled. Safe Browsing allows WebView to protect against malware and phishing attacks by verifying the links.

Safe Browsing can be disabled for all WebViews using a manifest tag (read general Safe Browsing info). The manifest tag has a lower precedence than this API.

Safe Browsing is enabled by default for devices which support it.

Parameters
enabled Whether Safe Browsing is enabled.

public synchronized void setSansSerifFontFamily (String font)

Sets the sans-serif font family name. The default is "sans-serif".

Parameters
font a font family name

public void setSaveFormData (boolean save)

Sets whether the WebView should save form data. In Android O, the platform has implemented a fully functional Autofill feature to store form data. Therefore, the Webview form data save feature is disabled. Note that the feature will continue to be supported on older versions of Android as before. This function does not have any effect.

public void setSavePassword (boolean save)

This method is deprecated.
Saving passwords in WebView will not be supported in future versions.

Sets whether the WebView should save passwords. The default is true.

public synchronized void setSerifFontFamily (String font)

Sets the serif font family name. The default is "sans-serif".

Parameters
font a font family name

public synchronized void setStandardFontFamily (String font)

Sets the standard font family name. The default is "sans-serif".

Parameters
font a font family name

public void setSupportMultipleWindows (boolean support)

Sets whether the WebView whether supports multiple windows. If set to true, onCreateWindow(WebView, boolean, boolean, Message) must be implemented by the host application. The default is false.

Parameters
support whether to support multiple windows

public void setSupportZoom (boolean support)

Sets whether the WebView should support zooming using its on-screen zoom controls and gestures. The particular zoom mechanisms that should be used can be set with setBuiltInZoomControls(boolean). This setting does not affect zooming performed using the zoomIn() and zoomOut() methods. The default is true.

Parameters
support whether the WebView should support zoom

public synchronized void setTextZoom (int textZoom)

Sets the text zoom of the page in percent. The default is 100.

Parameters
textZoom the text zoom in percent

public void setUseWideViewPort (boolean use)

Sets whether the WebView should enable support for the "viewport" HTML meta tag or should use a wide viewport. When the value of the setting is false, the layout width is always set to the width of the WebView control in device-independent (CSS) pixels. When the value is true and the page contains the viewport meta tag, the value of the width specified in the tag is used. If the page does not contain the tag or does not provide a width, then a wide viewport will be used.

Parameters
use whether to enable support for the viewport meta tag

public void setUserAgent (String ua)

Sets the WebView's user-agent string. If the string is null or empty, the system default value will be used. Note that starting from android.os.Build.VERSION_CODES#KITKAT Android version, changing the user-agent while loading a web page causes WebView to initiate loading once again.

Parameters
ua new user-agent string

public void setUserAgentString (String ua)

Sets the WebView's user-agent string. If the string is null or empty, the system default value will be used. Note that starting from android.os.Build.VERSION_CODES#KITKAT Android version, changing the user-agent while loading a web page causes WebView to initiate loading once again.

Parameters
ua new user-agent string

public synchronized boolean supportMultipleWindows ()

Gets whether the WebView supports multiple windows.

Returns
  • true if the WebView supports multiple windows

public boolean supportZoom ()

Gets whether the WebView supports zoom.

Returns
  • true if the WebView supports zoom