Wappler Version : 5.5.1 (Probably has been so since v1)
Operating System : W11
Meta tag is set correctly as suggested in this post.
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
But when page loads, the width returned by browser1.viewport.width
is 600+, even thought the actual viewport is just 425.
Checking the viewport on dev console using window.innerWidth
and window.outerWidth
correctly returns 425.
In this state, if I scroll the page, the value from browser1.viewport.width
changes to 425.
Diving into the issue, we could identify the issue to be because of the size of binding text on page.
Here is a simple content page, created on a fresh project in 5.5.1
<!-- Wappler include head-page="layouts/main" fontawesome_5="cdn" bootstrap5="local" is="dmx-app" id="index" appConnect="local" -->
<meta name="ac:route" content="/">
<div class="container">
<div class="row">
<div class="col-4">Width : {{browser1.viewport.width}}</div>
<div class="col-4">Height : {{browser1.viewport.height}}</div>
<h1>
{{browser1.viewport.width+''+browser1.viewport.width}}</h1>
</div>
</div>
The problem here is {{browser1.viewport.width+''+browser1.viewport.width}}
.
Because this binding’s text is bigger than 425 in width, before AppConnect parses this binding, the viewport width in browser component gets recorded incorrectly.
We have many such large bindings on the page - {{scGetPageInfo.data.qInformation.dataJson.xxx.yyy..}}
.
We have numerous images and videos on this app which are dependent on the viewport value to render correct responsive media… and its broken because of this.
We hadn’t noticed this until we had to change a video yesterday, and we did not see the mobile version playing.
Expected solution is to get the correct viewport from the browser component irrespective of the content on page.