0

Many people have answered how to get the user-agent from a WebView, but I need the default user-agent that is normally sent in the http headers of an NSURLRequest. What is the best way to get that one?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
John Bushnell
  • 1,851
  • 22
  • 29
  • NSURLRequest has a property called `allHTTPHeaderFields` that returns a dictionary. I don't know which key matches what you're looking for but, if you print the structure, you should be able to find it. – Phillip Mills Dec 18 '17 at 19:19
  • @PhillipMills That field appears to be empty unless you start the NSURLRequest. – John Bushnell Jan 04 '18 at 03:02
  • Does this answer your question? [How to get the user agent on iOS?](https://stackoverflow.com/questions/8579019/how-to-get-the-user-agent-on-ios) – Alex Cohn Oct 18 '21 at 09:01

0 Answers0