List icon Contents


This guide shows how to work with Zoom API.

JxBrowser allows to zoom content of a web page or of all web pages, get notifications when the zoom level of a web page has been changed, override the default zoom level, etc.

To work with the global zoom that will apply to all web pages please use the ZoomLevels class. An instance of this class you can obtain from Profile. For example:

ZoomLevels zoomLevels = profile.zoomLevels();
val zoomLevels = profile.zoomLevels()

If you use Engine.zoomLevels() then you get the ZoomLevels instance associated with the default profile.

To control zoom of a web page loaded in a Browser instance use the Zoom class.

Default zoom level

The default zoom level for all web pages is 100%. To change the default zoom level please use the ZoomLevels.defaultLevel(ZoomLevel) method.

The following code sets the default zoom level for all web pages to 150%:


Controlling zoom

You can zoom content of a web page loaded in Browser programmatically using the Zoom class or using touch gestures in the environments with touch screen.

Zoom level is configured for each host separately. If you set a zoom level for the web page, it will not be changed for the web page.

To change the zoom level you need to wait until the web page is loaded completely.

Zoom in

To perform zoom in on a currently loaded web page use the following method:;

Zoom out

To perform zoom out on a currently loaded web page use the following method:


Setting zoom level

The following code sets zoom level of the loaded web page to 200%:


Resetting zoom

To reset zoom level to the default value use the following code:


Disabling zoom

You can disable zoom for all web pages loaded in a Browser using the Zoom.disable() method. This method disables the zoom functionality and resets the zoom level to the default value. After that all attempts to change the zoom level programmatically via JxBrowser Zoom API and using touch gestures on a touch screen device will be ignored.

For example:


Zoom events

To get notifications when the zoom level for a particular web page has been changed use the ZoomLevelChanged event. For example:

zoomLevels.on(ZoomLevelChanged.class, event -> {
    Host host =;
    ZoomLevel zoomLevel = event.level();
zoomLevels.on( { event ->
    val host =
    val zoomLevel = event.level()

Pinch to zoom

Currently, JxBrowser does not support zoom via a pinch-to-zoom trackpad gesture on macOS.

Go Top