Help! Disabling website zoom on a mobile device

Hello.

How can I disable the enlargement of the website by two new ones on the mobile device?
I’ve already tried everything, but unfortunately it still lets me.
Can someone help? Unfortunately, it would be quite urgent, I don’t have time now.

Thanks if someone helps.

Hi, not sure what you mean by ‘…two new ones’, sorry!

Yes, but in the meantime I solved it with the small script below.

(function () {
    function disableZoom() {
        // Megakadályozza a nagyítást a gesturestart eseményen keresztül
        document.addEventListener('gesturestart', function (e) {
            e.preventDefault();
        });

        // Megakadályozza a dupla koppintást a nagyításra a touchend eseményen keresztül
        var lastTouchEnd = 0;
        document.addEventListener('touchend', function (e) {
            var now = new Date().getTime();
            if (now - lastTouchEnd <= 300) {
                e.preventDefault();
            }
            lastTouchEnd = now;
        }, false);

        // Megakadályozza a nagyítást a többszörös ujjal való érintésen keresztül
        var touchCount = 0;
        document.addEventListener('touchstart', function (e) {
            touchCount += e.touches.length;
            if (touchCount > 1) {
                e.preventDefault();
            }
        });

        // Ellenőrzi a touchend eseményeket a touchstart események után
        document.addEventListener('touchend', function () {
            touchCount = 0;
        });
    }

    // Oldal betöltésekor futtatjuk a funkciót
    window.addEventListener('load', disableZoom);
})();

There is a tick box for this in page settings.

Although ideally you want users to be able to pinch to zoom on mobile for usability.

https://help.blocsapp.com/knowledge-base/page-settings/#allow-mobile-zoom

Is it just me or the wording here backwards :grin: (@norm)

I already tried that, but it doesn’t work, even though I tried it in several browsers

Check the meta tag is in the header of the html.

Should be something like this


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

Yes, it was there, but it didn’t work, I also tried it in an empty project, but not there either. This little javascript is good, for the most part. :smile:

Maybe it’s helpful if you state the things you have already done. So people don’t waste time doing the same thing :grin:

I know you already said this, I would have written it anyway, but I didn’t have time yet, I just got back to the machine.

People might run out of time to help too :joy:

1 Like

:joy: Possible

Post what your header meta tag says.

Because browsers will follow the tag.

I’ll post a little later

Well you said it was urgent and the thread could be shorter. If someone wants to help they have to pull teeth.

I’m only on my phone.