How to disable browser zoom functionality in web application

I’m building a web app that includes drag and drop features, and I want to ensure users cannot zoom in or out on the page. I’ve tried various methods, but they don’t seem effective.

Initially, I implemented the following meta tag:

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />

Additionally, I attempted to prevent zooming through JavaScript by adding an event listener for mouse wheel actions:

document.addEventListener("wheel", disableZoom);

function disableZoom(event) {
  console.log(event);
  event.preventDefault();
}

Unfortunately, these approaches still allow users to zoom using keyboard shortcuts or pinch gestures. What is the most effective method to completely disable zoom functionality like what design tools achieve?

Honestly, you can’t do this 100%. I spent weeks trying to disable zoom on a touch project and eventually gave up. Browsers don’t let you mess with their core functions. Maybe detect zoom changes and show a warning instead? That’s what some online editors do when zoom gets out of hand.

I’ve hit this exact issue with a canvas drawing app. You can’t completely prevent zoom - browsers won’t let you because of security and accessibility reasons. But you can get pretty close with a few tricks combined. First, slap touch-action: none; on your drag elements. This kills pinch-to-zoom on mobile for those specific parts. For keyboard shortcuts, catch Ctrl+Plus, Ctrl+Minus, and Ctrl+0 with keydown events. Here’s what actually worked for me: don’t fight the zoom, adapt to it. Watch window.devicePixelRatio and window.innerWidth for changes, then adjust your drag boundaries or reset the zoom level when it happens. Way more reliable than trying to block everything.

u can’t really turn off zoom completely. browsers prioritize user accessibility. even if u block shortcuts, users can zoom via the browser menu. it’s better to make your drag/drop features work nicely even when zoomed in.

Been working on web apps for years and this is a common headache. Browsers intentionally make it hard to disable zoom completely because it breaks accessibility standards. But there’s a workaround I’ve used successfully. Don’t fight the zoom - detect when it happens and reset the viewport programmatically. Monitor the window.visualViewport API to catch zoom events, then immediately counteract them by adjusting document scale with CSS transforms. This works way better than trying to prevent zoom altogether. The trick is being quick about the reset so users barely notice. It’s not perfect but gives you much better control over UX.