Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WKWebView: scalesPageToFit behaviour without Java Script

How to get scalesPageToFit behaviour for HTML content displayed in a WKWebView without using JavaScript? (disabling JS is a requirement for in our case).

Sorry for not posting any code, but I have no idea how I could achieve this. All solutions I know and all I found are based on JS. Example.

I already add <meta name="viewport" content="width=device-width, initial-scale=1.0"/> to the HTML if it does not exist yet, but at least images are often displayed way too big.

All images are provided to WKWebView by a WKURLSchemeHandler.

like image 847
shallowThought Avatar asked Dec 14 '25 10:12

shallowThought


1 Answers

Please put

<meta name="viewport" content="initial-scale=1.0" />

inside your <head> tag.

like image 133
PPL Avatar answered Dec 15 '25 22:12

PPL



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!