Interface BrowserSettings


public interface BrowserSettings
The settings of the browser.
  • Method Details

    • browser

      Browser browser()
      Returns the Browser instance configured by this settings.
      Since:
      7.28
    • defaultEncoding

      String defaultEncoding()
      Returns a string that represents the default text encoding.
    • defaultEncoding

      void defaultEncoding(String defaultEncoding)
      Updates the default text encoding with the given value.
      Parameters:
      defaultEncoding - a string that represents the new default text encoding
      Throws:
      IllegalArgumentException - when defaultEncoding is empty or blank
      ObjectClosedException - 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

      void defaultBackgroundColor(Color color)
      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

      void webRtcIpHandlingPolicy(WebRtcIpHandlingPolicy policy)
      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 the document.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 the document.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 the document.cookie property.

      If JavaScript is not allowed to read/write cookies then document.cookie will return an empty string, and document.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 closed
      UnsupportedRenderingModeException - 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 closed
      UnsupportedRenderingModeException - when the current rendering mode is not supported
      Since:
      7.2
    • isTransparentBackgroundEnabled

      boolean isTransparentBackgroundEnabled()
      Returns true 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 closed
      UnsupportedRenderingModeException - when the current rendering mode is not supported
      Since:
      7.2
    • isOverscrollHistoryNavigationEnabled

      boolean isOverscrollHistoryNavigationEnabled()
      Indicates whether the browser can navigate back/forward with a left/right swipe on a devices with touch screen. By default, the overscroll navigation is disabled.
      Throws:
      ObjectClosedException - when the browser is closed
      Since:
      7.9
    • enableOverscrollHistoryNavigation

      void enableOverscrollHistoryNavigation()
      Allows back/forward navigation with a left/right swipe.
      Throws:
      ObjectClosedException - when the browser is closed
      Since:
      7.9
    • disableOverscrollHistoryNavigation

      void disableOverscrollHistoryNavigation()
      Disallows back/forward navigation with a left/right swipe.
      Throws:
      ObjectClosedException - when the browser is closed
      Since:
      7.9
    • defaultFontSize

      void defaultFontSize(FontSizeInPixels fontSize)
      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 the display-mode CSS media feature for the browser.
      Throws:
      ObjectClosedException - when the browser is closed
      Since:
      7.38
    • displayMode

      void displayMode(DisplayMode displayMode)
      Overrides the display-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