Using UniWebView 4.12.1 on iOS and Android.
We want to fix the width of our website for all devices, so that it has identical appearance regardless of the device size. There is a nice tool in HTML for that:
<meta name="viewport" content="width=320, user-scalable=no"/>
It works smoothly on Android and in the Safari app. But for some reason, it breaks smooth scrolling in UniWebView on iOS. And there's another side effect: the website starts jerking when you scroll pas the edges (like there's some script that tries to prevent bouncing).
If we change width to device-width
it scrolls smoothly again.
So, is there a way to use fixed size viewport with UniWebView on iOS without breaking smooth scrolling?
Update 10.08.2022
It seems that differen widths work smoothly for some Apple devices but break smooth scrolling for the other devices. For example, if I set width=354
:
- iPhone 13 Mini: smooth scrolling
- iPhone 13 Pro Max: broken scrolling
- iPhone 11 Pro Max: broken scrolling
width=355
- iPhone 13 Mini: broken scrolling
- iPhone 13 Pro Max: smooth scrolling
- iPhone 11 Pro Max: smooth scrolling
This strange problem which seems to be exclusive for iOS webview was solved by:
initial-scale
,minimum-scale
andmaximum-scale
Code: