Is there a way to detect Browser Zoom Level?

Hello, I need to find a way to detect Browser zoom level. If someone have an idea ? thank you !

Some JavaScript would do it. The following is from here

Using the window.devicePixelRatio Property

One way to detect the browser zoom level is to use the window.devicePixelRatio property.

For instance, we can write:

window.addEventListener(‘resize’, () => {
const browserZoomLevel = Math.round(window.devicePixelRatio * 100);
console.log(browserZoomLevel)
})

When we zoom in or out, the resize event will be triggered.

So we can listen to it with addEventListener .

In the event handler callback, we get the window.devicePixelRatio which has the ratio between the current pixel size and the regular pixel size.

1 Like

hello @jared.gibb and thank for your help.

Can you please give me some advice to use it in Bubble ? I think I need to use toolbox but in reality I never used it !!!

I’ve never used toolbox. I’d publish a small plugin element that does this if I was to use it.

I should probably learn to use toolbox. A full plugin is overkill probably

yes I need to learn toolbox too !!!

1 Like

Looks like I know what I’m doing today

This topic was automatically closed after 70 days. New replies are no longer allowed.