WebSettingsCompat

open class WebSettingsCompat
kotlin.Any
   ↳ androidx.webkit.WebSettingsCompat

Compatibility version of android.webkit.WebSettings

Summary

Public methods

open static Int

Gets the action mode menu items that are disabled, expressed in an integer field flag.

open static Boolean

Gets whether this WebView should raster tiles when it is offscreen but attached to a window.

open static Boolean

Gets whether Safe Browsing is enabled.

open static Unit
setDisabledActionModeMenuItems(webSettings: WebSettings!, menuItems: Int)

Disables the action mode menu items according to menuItems flag.

open static Unit
setOffscreenPreRaster(webSettings: WebSettings!, enabled: Boolean)

Sets whether this WebView should raster tiles when it is offscreen but attached to a window.

open static Unit
setSafeBrowsingEnabled(webSettings: WebSettings!, enabled: Boolean)

Sets whether Safe Browsing is enabled.

Public methods

getDisabledActionModeMenuItems

open static fun getDisabledActionModeMenuItems(webSettings: WebSettings!): Int

Gets the action mode menu items that are disabled, expressed in an integer field flag. The default value is WebSettings#MENU_ITEM_NONE

This method should only be called if WebViewFeature#isFeatureSupported(String) returns true for WebViewFeature#DISABLED_ACTION_MODE_MENU_ITEMS.

Return
Int: all the disabled menu item flags combined with bitwise OR.

getOffscreenPreRaster

open static fun getOffscreenPreRaster(webSettings: WebSettings!): Boolean

Gets whether this WebView should raster tiles when it is offscreen but attached to a window.

This method should only be called if WebViewFeature#isFeatureSupported(String) returns true for WebViewFeature#OFF_SCREEN_PRERASTER.

Return
Boolean: true if this WebView will raster tiles when it is offscreen but attached to a window.

getSafeBrowsingEnabled

open static fun getSafeBrowsingEnabled(webSettings: WebSettings!): Boolean

Gets whether Safe Browsing is enabled. See setSafeBrowsingEnabled.

This method should only be called if WebViewFeature#isFeatureSupported(String) returns true for WebViewFeature#SAFE_BROWSING_ENABLE.

Return
Boolean: true if Safe Browsing is enabled and false otherwise.

setDisabledActionModeMenuItems

open static fun setDisabledActionModeMenuItems(webSettings: WebSettings!, menuItems: Int): Unit

Disables the action mode menu items according to menuItems flag.

This method should only be called if WebViewFeature#isFeatureSupported(String) returns true for WebViewFeature#DISABLED_ACTION_MODE_MENU_ITEMS.

Parameters
menuItems WebSettings!: an integer field flag for the menu items to be disabled.

setOffscreenPreRaster

open static fun setOffscreenPreRaster(webSettings: WebSettings!, enabled: Boolean): Unit

Sets whether this WebView should raster tiles when it is offscreen but attached to a window. Turning this on can avoid rendering artifacts when animating an offscreen WebView on-screen. Offscreen WebViews in this mode use more memory. The default value is false.
Please follow these guidelines to limit memory usage:

  • WebView size should be not be larger than the device screen size.
  • Limit use of this mode to a small number of WebViews. Use it for visible WebViews and WebViews about to be animated to visible.

This method should only be called if WebViewFeature#isFeatureSupported(String) returns true for WebViewFeature#OFF_SCREEN_PRERASTER.

setSafeBrowsingEnabled

open static fun setSafeBrowsingEnabled(webSettings: WebSettings!, enabled: Boolean): Unit

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.

This method should only be called if WebViewFeature#isFeatureSupported(String) returns true for WebViewFeature#SAFE_BROWSING_ENABLE.

Parameters
enabled WebSettings!: Whether Safe Browsing is enabled.