Post

Replies

Boosts

Views

Activity

Reply to how to disable Zoom-Out & Zoom-In
For anyone still having this issue you can fix it by adding some viewport constraints to the head of the html of the page you have loaded. I do this with some javascript I add to the end of the document:     lazy var webView: WKWebView = {         let configuration = WKWebViewConfiguration()         let source: String = "var meta = document.createElement('meta');" +             "meta.name = 'viewport';" +             "meta.content = 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no';" +             "var head = document.getElementsByTagName('head')[0];" +        &#9;&#9; "head.appendChild(meta);"         let script: WKUserScript = WKUserScript(source: source, injectionTime: .atDocumentEnd, forMainFrameOnly: true)         configuration.userContentController.addUserScript(script)         let webView = WKWebView(frame: .zero, configuration: configuration)         webView.navigationDelegate = self         return webView     }() Alternatively if you are loading in html yourself you can get the same result like this:  webView.loadHTMLString("<html><head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0 maximum-scale=1.0 user-scalable=no\" charset=\"utf-8\" /></head><body>\(YOUR-HTML-CODE-HERE)</body></html>", baseURL: nil) Hope this helps!
Oct ’20