I want to get the desktop version URL response in iOS devices. But I always get the mobile version URL response. Here is my code:
var request = URLRequest(url: URL(string: "https://www.youtube.com")!)
request.addValue("Chrome Safari", forHTTPHeaderField: "User-Agent")
let session = URLSession.init(configuration: URLSessionConfiguration.default)
let task = session.dataTask(with: request) { (data, response, error) in
if let data = data, let str = String(data: data, encoding: .utf8) {
print(str)
}
}
task.resume()
That code will get mobile version response. How can I get desktop version URL response?
I want to get the og
information of the desktop response, not using WKWebView
to present website.
question from:
https://stackoverflow.com/questions/65880616/swift-ios-how-to-get-desktop-version-url-response 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…