The import UIKit
The import its
The class ViewController: UIViewController {
@ IBOutlet weak var webview: WKWebView!
Override func viewDidLoad () {
Super viewDidLoad ()
Webview. CustomUserAgent="ASDF"
Let the url=url (string: "http://qvni.cn/agent")
Let the request=URLRequest (url: the url!
Webview. Load (request)
}
}
CodePudding user response:
Help you top itCodePudding user response:
Resolved:Let the conf=WKWebViewConfiguration ()
The conf. ApplicationNameForUserAgent="userAgentAppend"
WebView=WKWebView (frame: view. SafeAreaLayoutGuide. LayoutFrame, configuration: the conf)