Home > Mobile >  WKWebview changes the user-agent failure, the code is as follows
WKWebview changes the user-agent failure, the code is as follows

Time:10-20

After running the agent not become custom content

 
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 it

CodePudding user response:

Resolved:
Let the conf=WKWebViewConfiguration ()
The conf. ApplicationNameForUserAgent="userAgentAppend"
WebView=WKWebView (frame: view. SafeAreaLayoutGuide. LayoutFrame, configuration: the conf)
  • Related