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.