Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

99
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!