Interface BrowserSettings
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Allows JavaScript code on the web pages loaded in the browser to access clipboard.void
Allows JavaScript code on the web pages loaded in the browser to read/write cookies in the cookies storage using thedocument.cookie
property.void
Allows loading images automatically on the web pages loaded in the browser.void
Allows running an insecure content in the browser.void
Allows JavaScript code on the web pages loaded in the browser to close the browser.browser()
Returns theBrowser
instance configured by this settings.Returns the default background color of the web pages loaded in the browser instance associated with these settings.void
defaultBackgroundColor
(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.void
defaultEncoding
(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.void
defaultFontSize
(FontSizeInPixels fontSize) Sets the default font size of the web content in the browser.void
Disables images displaying on the web pages loaded in the browser.void
Disables JavaScript on the web pages loaded in the browser.void
Disables the local storage in the browser.void
Disallows back/forward navigation with a left/right swipe.void
Disables all plugins on the web pages loaded in the browser.void
Disables transparent background on the web pages and makes it opaque.void
Disallows JavaScript code on the web pages loaded in the browser to access clipboard.void
Disallows JavaScript code on the web pages loaded in the browser to read/write cookies in the cookies storage using thedocument.cookie
property.void
Disallows loading images automatically on the web pages loaded in the browser.void
Disallows running an insecure content in the browser.void
Disallows JavaScript code on the web pages loaded in the browser to close the browser.Returns thedisplay-mode
CSS media feature for the browser.void
displayMode
(DisplayMode displayMode) Overrides thedisplay-mode
CSS media feature for the browser with the given one.void
Enables images displaying on the web pages loaded in the browser.void
Enables JavaScript on the web pages loaded in the browser.void
Enables the local storage in the browser.void
Allows back/forward navigation with a left/right swipe.void
Enables all plugins on the web pages loaded in the browser.void
Enables transparent background on the web pages.void
Hides the scrollbars on the web pages loaded in the browser.boolean
Indicates whether JavaScript code on the web pages loaded in the browser can access clipboard.boolean
Indicates whether JavaScript code is allowed to read/write cookies in the browser cookies storage.boolean
Indicates whether images are allowed to be loaded automatically on the web pages loaded in the browser.boolean
Indicates whether an insecure content can run in the browser.boolean
Indicates whether JavaScript code on the web pages loaded in the browser can close the browser.boolean
Indicates whether images are displayed on the web pages loaded in the browser.boolean
Indicates whether JavaScript on the web pages loaded in the browser is enabled.boolean
Indicates whether the local storage in the browser is enabled.boolean
Indicates whether the browser can navigate back/forward with a left/right swipe on a devices with touch screen.boolean
Indicates whether plugins are enabled on the web pages loaded in the browser.boolean
Returnstrue
when the transparent background on the web pages is enabled.boolean
Indicates whether scrollbars on a web page loaded in the browser are hidden.void
Shows the scrollbars on the web pages loaded in the browser.Returns the WebRTC IP handling policy for the browser.void
Updates the WebRTC IP handling policy for the browser with the given one.
-
Method Details
-
browser
Browser browser()Returns theBrowser
instance 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
- whendefaultEncoding
is 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 on the web pages loaded in the browser can access clipboard. By default, JavaScript is not allowed to access clipboard.- Throws:
ObjectClosedException
- when the browser is closed
-
allowJavaScriptAccessClipboard
void allowJavaScriptAccessClipboard()Allows JavaScript code on the web pages loaded in the browser to access clipboard.- Throws:
ObjectClosedException
- when the browser is closed
-
disallowJavaScriptAccessClipboard
void disallowJavaScriptAccessClipboard()Disallows JavaScript code on the web pages loaded in the browser to access clipboard.- 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.cookie
property.- 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.cookie
property.- 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.cookie
property.If JavaScript is not allowed to read/write cookies then
document.cookie
will 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_SCREEN
rendering 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_SCREEN
rendering 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()Returnstrue
when the transparent background on the web pages is enabled.This method supports only the
OFF_SCREEN
rendering 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-mode
CSS media feature for the browser.- Throws:
ObjectClosedException
- when the browser is closed- Since:
- 7.38
-
displayMode
Overrides thedisplay-mode
CSS 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
-