Just curious if any of the default functions get called more than once.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I need to get my iPad to use the desktop version of a user agent however so far this is not working
let webConfiguration = WKWebViewConfiguration()
if #available(iOS 13.0, *) {
webConfiguration.defaultWebpagePreferences.preferredContentMode = .desktop
} else {
// Fallback on earlier versions
}
let webView = WKWebView(frame: .zero, configuration: webConfiguration)
webView.evaluateJavaScript("navigator.userAgent") { result, _ in
var userAgent: UIAlertController!
userAgent = UIAlertController(title: "user agent", message: result as? String, preferredStyle: .alert)
userAgent.addAction(UIAlertAction(title: "Ok", style: .default, handler: nil))
UIApplication.shared.windows.first?.rootViewController?.present(userAgent, animated: false, completion: nil)
}