Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

96
Vistas
Meta tag viewport add unwanted space on the page with QML WebEngineView

I have to display a third party web page (which a I can't edit) on a WebEngineView (version 1.3) on my embedded device. The device has a display with a fixed resolution of 800x480.

This page has this viewport meta tag which is the cause of my problem:

<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

Once the page is loaded the content size inside the WebEngineView is correctly 800px. But the user can scroll horizontally and move the content to the left. It seems that once the user start scrolling the page the content width changes to 3200px (checked with some debug print).

I've tried to add a WebEngineScript to remove the meta tag, but it doesn't seems to work:

WebEngineScript {
   id: removeMeta
   injectionPoint: WebEngineScript.DocumentReady
   sourceCode: "document.querySelector(\"[name='viewport']\").remove();"
}

WebEngineView {
   ind: webview
   ...
   userScripts: [ removeMeta ]
   ...

   onLoadingChanged: {
      if (loadRequest.status === WebEngineView.LoadSucceededStatus
      {
          var js = "document.documentElement.outerHTML";
          webview.runJavaScript(js, function(result){console.log(result);})
      }
   }
}

If I print the inner HTML of the page when the render is completed the meta tag is not present. If I change the injectionPoint to WebEngineScript.DocumentCreation the tag remains.

How can I ignore the meta tag and prevent the unwanted horizontal scrolling?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda