Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let jscript = "var meta = document.createElement('meta'); meta.setAttribute('name', 'viewport'); meta.setAttribute('content', 'width=device-width'); document.getElementsByTagName('head')[0].appendChild(meta);"
- let userScript = WKUserScript(source: jscript, injectionTime: .atDocumentEnd, forMainFrameOnly: true)
- let wkUController = WKUserContentController()
- wkUController.addUserScript(userScript)
- let wkWebConfig = WKWebViewConfiguration()
- wkWebConfig.userContentController = wkUController
- let yourWebView = WKWebView(frame: self.view.bounds, configuration: wkWebConfig)// yourwebview is the webview that you are using.
Add Comment
Please, Sign In to add comment