Prevent Zoom

Hi

The code below prevents zooming on web page.
How to do the same with TMS webCore as
If I apply this code to main page or on any event on the form it has no effect.

<script>
        // Prevent zoom using keyboard shortcuts (Ctrl/Cmd + + or -)
        document.addEventListener('keydown', function(event) {
            if ((event.ctrlKey || event.metaKey) && (event.key === '+' || event.key === '-' || event.key === '0')) {
                event.preventDefault();
            }
        });

        // Prevent zoom using touch gestures (pinch)
        document.addEventListener('wheel', function(event) {
            if (event.ctrlKey) {
                event.preventDefault();
            }
        }, { passive: false });

        // Prevent double-tap to zoom
        let lastTouchEnd = 0;
        document.addEventListener('touchend', function(event) {
            let now = (new Date()).getTime();
            if (now - lastTouchEnd <= 300) {
                event.preventDefault();
            }
            lastTouchEnd = now;
        }, false);
    </script>

Perhaps something with caching?
Try to do a full cache reload.
I tested this and it worked here in the TMS WEB Core app.
Project1.zip (5.5 KB)

  1. Open this project.
  2. It doesn't zoom.
  3. press webbutton5. It just resizes panel.
  4. now it zooms.

Same happens if I add client aligned panel.
checked on chrome, brave and opera.

exampl;e_zoom.zip (6.6 KB)

Just found another thing.
If mouse is inside panel then zooming works. If on form then it doesn't.

It is because this button5 gets focus and your code isn't overriding the key input of button5.
Do this for example to prevent it:

procedure TForm1.WebButton5Click(Sender: TObject);
begin
  pnlTop.Height := 300;
  webbutton5.ElementHandle.blur;
end;