Change User Agent in UIWebView

前端 未结 14 1972
孤城傲影
孤城傲影 2020-11-22 17:03

I have a business need to be able to customize the UserAgent for an embedded UIWebView. (For instance, I\'d like the server to respond differently if, say, a user is using

14条回答
  •  不要未来只要你来
    2020-11-22 17:51

    Apple will soon stop accepting apps with UIWebView. Find below for how you could change the user agent in WKWebView.

    let config = WKWebViewConfiguration()
    
    config.applicationNameForUserAgent = "My iOS app"
    
    webView = WKWebView(frame: , configuration: config)
    

提交回复
热议问题