Interface BrowserSettings
-
Method Summary
Modifier and TypeMethodDescriptionvoidAllows JavaScript to write to the clipboard usingdocument.execCommand('copy')without the user activation.voidAllows JavaScript code on the web pages loaded in the browser to read/write cookies in the cookies storage using thedocument.cookieproperty.voidAllows loading images automatically on the web pages loaded in the browser.voidAllows running an insecure content in the browser.voidAllows JavaScript code on the web pages loaded in the browser to close the browser.browser()Returns theBrowserinstance configured by this settings.Returns the default background color of the web pages loaded in the browser instance associated with these settings.voiddefaultBackgroundColor(Color color) Sets the default background color of the web pages loaded in the browser instance associated with these settings.Returns a string that represents the default text encoding.voiddefaultEncoding(String defaultEncoding) Updates the default text encoding with the given value.Returns the default font size in pixels of the web content in the browser.voiddefaultFontSize(FontSizeInPixels fontSize) Sets the default font size of the web content in the browser.voidDisables images displaying on the web pages loaded in the browser.voidDisables JavaScript on the web pages loaded in the browser.voidDisables the local storage in the browser.voidDisallows back/forward navigation with a left/right swipe.voidDisables all plugins on the web pages loaded in the browser.voidDisables transparent background on the web pages and makes it opaque.voidDisallows JavaScript to write to the clipboard usingdocument.execCommand('copy')without the user activation.voidDisallows JavaScript code on the web pages loaded in the browser to read/write cookies in the cookies storage using thedocument.cookieproperty.voidDisallows loading images automatically on the web pages loaded in the browser.voidDisallows running an insecure content in the browser.voidDisallows JavaScript code on the web pages loaded in the browser to close the browser.Returns thedisplay-modeCSS media feature for the browser.voiddisplayMode(DisplayMode displayMode) Overrides thedisplay-modeCSS media feature for the browser with the given one.voidEnables images displaying on the web pages loaded in the browser.voidEnables JavaScript on the web pages loaded in the browser.voidEnables the local storage in the browser.voidAllows back/forward navigation with a left/right swipe.voidEnables all plugins on the web pages loaded in the browser.voidEnables transparent background on the web pages.voidHides the scrollbars on the web pages loaded in the browser.booleanIndicates whether JavaScript code is permitted to write to the clipboard usingdocument.execCommand('copy')without the user activation.booleanIndicates whether JavaScript code is allowed to read/write cookies in the browser cookies storage.booleanIndicates whether images are allowed to be loaded automatically on the web pages loaded in the browser.booleanIndicates whether an insecure content can run in the browser.booleanIndicates whether JavaScript code on the web pages loaded in the browser can close the browser.booleanIndicates whether images are displayed on the web pages loaded in the browser.booleanIndicates whether JavaScript on the web pages loaded in the browser is enabled.booleanIndicates whether the local storage in the browser is enabled.booleanIndicates whether the browser can navigate back/forward with a left/right swipe on a devices with touch screen.booleanIndicates whether plugins are enabled on the web pages loaded in the browser.booleanReturnstruewhen the transparent background on the web pages is enabled.booleanIndicates whether scrollbars on a web page loaded in the browser are hidden.voidShows the scrollbars on the web pages loaded in the browser.Returns the WebRTC IP handling policy for the browser.voidUpdates the WebRTC IP handling policy for the browser with the given one.
-
Method Details
-
browser
Browser browser()Returns theBrowserinstance configured by this settings.- Since:
- 7.28
-
defaultEncoding
String defaultEncoding()Returns a string that represents the default text encoding. -
defaultEncoding
Updates the default text encoding with the given value.- Parameters:
defaultEncoding- a string that represents the new default text encoding- Throws:
IllegalArgumentException- whendefaultEncodingis empty or blankObjectClosedException- when the browser is closed
-
defaultBackgroundColor
Color defaultBackgroundColor()Returns the default background color of the web pages loaded in the browser instance associated with these settings.Initially, the default background color is white.
- Throws:
ObjectClosedException- when the browser is closed
-
defaultBackgroundColor
Sets the default background color of the web pages loaded in the browser instance associated with these settings.This color will be used as a default background color when Chromium cannot identify the background color. This may happen if the page is not fully loaded, or the page does not explicitly override the default background.
If a web page is already loaded, its default background color will be updated and an asynchronous request to repaint the web page will be sent.
- Parameters:
color- the new default background color- Throws:
ObjectClosedException- when the browser is closed
-
isJavaScriptEnabled
boolean isJavaScriptEnabled()Indicates whether JavaScript on the web pages loaded in the browser is enabled.- Throws:
ObjectClosedException- when the browser is closed
-
enableJavaScript
void enableJavaScript()Enables JavaScript on the web pages loaded in the browser.- Throws:
ObjectClosedException- when the browser is closed
-
disableJavaScript
void disableJavaScript()Disables JavaScript on the web pages loaded in the browser.- Throws:
ObjectClosedException- when the browser is closed
-
isAllowLoadingImagesAutomatically
boolean isAllowLoadingImagesAutomatically()Indicates whether images are allowed to be loaded automatically on the web pages loaded in the browser.- Throws:
ObjectClosedException- when the browser is closed
-
allowLoadingImagesAutomatically
void allowLoadingImagesAutomatically()Allows loading images automatically on the web pages loaded in the browser.- Throws:
ObjectClosedException- when the browser is closed
-
disallowLoadingImagesAutomatically
void disallowLoadingImagesAutomatically()Disallows loading images automatically on the web pages loaded in the browser.- Throws:
ObjectClosedException- when the browser is closed
-
isImagesEnabled
boolean isImagesEnabled()Indicates whether images are displayed on the web pages loaded in the browser.- Throws:
ObjectClosedException- when the browser is closed
-
enableImages
void enableImages()Enables images displaying on the web pages loaded in the browser.- Throws:
ObjectClosedException- when the browser is closed
-
disableImages
void disableImages()Disables images displaying on the web pages loaded in the browser.- Throws:
ObjectClosedException- when the browser is closed
-
isPluginsEnabled
boolean isPluginsEnabled()Indicates whether plugins are enabled on the web pages loaded in the browser.- Throws:
ObjectClosedException- when the browser is closed
-
enablePlugins
void enablePlugins()Enables all plugins on the web pages loaded in the browser.- Throws:
ObjectClosedException- when the browser is closed
-
disablePlugins
void disablePlugins()Disables all plugins on the web pages loaded in the browser.- Throws:
ObjectClosedException- when the browser is closed
-
isAllowScriptsToCloseWindows
boolean isAllowScriptsToCloseWindows()Indicates whether JavaScript code on the web pages loaded in the browser can close the browser. By default, JavaScript is not allowed to close the browser.- Throws:
ObjectClosedException- when the browser is closed
-
allowScriptsToCloseWindows
void allowScriptsToCloseWindows()Allows JavaScript code on the web pages loaded in the browser to close the browser.- Throws:
ObjectClosedException- when the browser is closed
-
disallowScriptsToCloseWindows
void disallowScriptsToCloseWindows()Disallows JavaScript code on the web pages loaded in the browser to close the browser.- Throws:
ObjectClosedException- when the browser is closed
-
isAllowJavaScriptAccessClipboard
boolean isAllowJavaScriptAccessClipboard()Indicates whether JavaScript code is permitted to write to the clipboard usingdocument.execCommand('copy')without the user activation.By default, JavaScript is not allowed to write to the clipboard without the user activation.
- Throws:
ObjectClosedException- when the browser is closed
-
allowJavaScriptAccessClipboard
void allowJavaScriptAccessClipboard()Allows JavaScript to write to the clipboard usingdocument.execCommand('copy')without the user activation.Should you need to use
navigator.clipboard, grant the necessary permissions explicitly usingRequestPermissionCallback.- Throws:
ObjectClosedException- when the browser is closed
-
disallowJavaScriptAccessClipboard
void disallowJavaScriptAccessClipboard()Disallows JavaScript to write to the clipboard usingdocument.execCommand('copy')without the user activation.Should you need to use
navigator.clipboard, grant the necessary permissions explicitly usingRequestPermissionCallback.- Throws:
ObjectClosedException- when the browser is closed
-
isLocalStorageEnabled
boolean isLocalStorageEnabled()Indicates whether the local storage in the browser is enabled. By default, the local storage is enabled.- Throws:
ObjectClosedException- when the browser is closed
-
enableLocalStorage
void enableLocalStorage()Enables the local storage in the browser.- Throws:
ObjectClosedException- when the browser is closed
-
disableLocalStorage
void disableLocalStorage()Disables the local storage in the browser.- Throws:
ObjectClosedException- when the browser is closed
-
isAllowRunningInsecureContent
boolean isAllowRunningInsecureContent()Indicates whether an insecure content can run in the browser. By default, running insecure content is not allowed.- Throws:
ObjectClosedException- when the browser is closed
-
allowRunningInsecureContent
void allowRunningInsecureContent()Allows running an insecure content in the browser.- Throws:
ObjectClosedException- when the browser is closed
-
disallowRunningInsecureContent
void disallowRunningInsecureContent()Disallows running an insecure content in the browser.- Throws:
ObjectClosedException- when the browser is closed
-
webRtcIpHandlingPolicy
WebRtcIpHandlingPolicy webRtcIpHandlingPolicy()Returns the WebRTC IP handling policy for the browser.- Throws:
ObjectClosedException- when the browser is closed
-
webRtcIpHandlingPolicy
Updates the WebRTC IP handling policy for the browser with the given one.- Parameters:
policy- a new WebRTC IP handling policy- Throws:
ObjectClosedException- when the browser is closed
-
hideScrollbars
void hideScrollbars()Hides the scrollbars on the web pages loaded in the browser. If the scrollbars are already hidden, then this method does nothing.- Throws:
ObjectClosedException- when the browser is closed- Since:
- 7.1
-
showScrollbars
void showScrollbars()Shows the scrollbars on the web pages loaded in the browser. If the scrollbars are already shown, then this method does nothing.- Throws:
ObjectClosedException- when the browser is closed- Since:
- 7.1
-
scrollbarsHidden
boolean scrollbarsHidden()Indicates whether scrollbars on a web page loaded in the browser are hidden.- Throws:
ObjectClosedException- when the browser is closed- Since:
- 7.1
-
allowJavaScriptAccessCookies
void allowJavaScriptAccessCookies()Allows JavaScript code on the web pages loaded in the browser to read/write cookies in the cookies storage using thedocument.cookieproperty.- Throws:
ObjectClosedException- when the browser is closed- Since:
- 7.2
-
disallowJavaScriptAccessCookies
void disallowJavaScriptAccessCookies()Disallows JavaScript code on the web pages loaded in the browser to read/write cookies in the cookies storage using thedocument.cookieproperty.- Throws:
ObjectClosedException- when the browser is closed- Since:
- 7.2
-
isAllowJavaScriptAccessCookies
boolean isAllowJavaScriptAccessCookies()Indicates whether JavaScript code is allowed to read/write cookies in the browser cookies storage. By default, JavaScript is allowed to read/write cookies in the cookies storage using thedocument.cookieproperty.If JavaScript is not allowed to read/write cookies then
document.cookiewill return an empty string, anddocument.cookie='test-cookie=test'will not change cookies in the cookies storage.- Throws:
ObjectClosedException- when the browser is closed- Since:
- 7.2
-
enableTransparentBackground
void enableTransparentBackground()Enables transparent background on the web pages. By default, the background is always opaque.This method supports only the
OFF_SCREENrendering mode on Windows and Linux, and the both rendering modes on macOS. Throws an exception if the current rendering mode is not supported.- Throws:
ObjectClosedException- when the current browser is already closedUnsupportedRenderingModeException- when the current rendering mode is not supported- Since:
- 7.2
-
disableTransparentBackground
void disableTransparentBackground()Disables transparent background on the web pages and makes it opaque.This method supports only the
OFF_SCREENrendering mode on Windows and Linux, and the both rendering modes on macOS. Throws an exception if the current rendering mode is not supported.- Throws:
ObjectClosedException- when the current browser is already closedUnsupportedRenderingModeException- when the current rendering mode is not supported- Since:
- 7.2
-
isTransparentBackgroundEnabled
boolean isTransparentBackgroundEnabled()Returnstruewhen the transparent background on the web pages is enabled.This method supports only the
OFF_SCREENrendering mode on Windows and Linux, and the both rendering modes on macOS. Throws an exception if the current rendering mode is not supported.- Throws:
ObjectClosedException- when the current browser is already closedUnsupportedRenderingModeException- when the current rendering mode is not supported- Since:
- 7.2
-
defaultFontSize
Sets the default font size of the web content in the browser.Also, updates the default fixed-width font size and sets its value less by 3 than the given
fontSize.- Parameters:
fontSize- the font size to set as default. Must not be less than 9- Throws:
ObjectClosedException- when the browser is closed.IllegalArgumentException- when the given size is less than 9- Since:
- 7.20
-
defaultFontSize
FontSizeInPixels defaultFontSize()Returns the default font size in pixels of the web content in the browser.- Throws:
ObjectClosedException- when the browser is closed- Since:
- 7.20
-
displayMode
DisplayMode displayMode()Returns thedisplay-modeCSS media feature for the browser.- Throws:
ObjectClosedException- when the browser is closed- Since:
- 7.38
-
displayMode
Overrides thedisplay-modeCSS media feature for the browser with the given one.It does not affect the appeal of the browser view. It only changes the value of the CSS media feature.
- Parameters:
displayMode- a display mode for the browser- Throws:
ObjectClosedException- when the browser is closed- Since:
- 7.38
-