Evaluating Javascript using WKWebView in iOS
Sample of page loaded in web view: <html> <body> <script> function getWindowInfo() { return { width: window.innerWidth || document.body.clientWidth, height: window.innerHeight || document.body.clientHeight } }; </script> </body> </html> In a UIView or UIViewController: import WebKit // Enable Javascript in web view let config = WKWebViewConfiguration() let prefs = WKPreferences() prefs.javaScriptEnabled = true config.preferences = prefs …
Continue reading “Evaluating Javascript using WKWebView in iOS”