-1

I am setting user-agent to test a iOS app from my Java client this way -

urlc.setRequestProperty("user-agent", "Mozilla/5.0 (Windows NT 5.1; rv:19.0) Gecko/20100101 Firefox/19.0");

However, in the JSON response I am getting an error that this app can only be tested on an iOS device (which is a custom response I have when the app is tested from a non-IOS device. So what is the correct way to set user-agent in Java?

Darshan Patel
  • 3,176
  • 6
  • 26
  • 49
rickygrimes
  • 2,637
  • 9
  • 46
  • 69
  • If you are supposed to be running from IOS, then the UA would be safari wouldn't it? – Scary Wombat Jan 31 '14 at 04:48
  • http://stackoverflow.com/questions/19264114/user-agent-for-safari-browser-on-ios-7 http://stackoverflow.com/questions/12305566/what-is-the-ios-6-user-agent-string – RaceBase Jan 31 '14 at 04:49

1 Answers1

0

A browser sends a special string, called a user agent, to websites to identify itself. The web server, or JavaScript in the downloaded webpage, detects the client’s identity and can modify its behavior accordingly. In the simplest case, the user agent string includes an application name—for example, Navigator as the application name and 6.0 as the version. Safari on the desktop and Safari on iOS have their own user agent strings, too.

enter image description here

https://developer.apple.com/library/ios/documentation/AppleApplications/Reference/SafariWebContent/OptimizingforSafarioniPhone/OptimizingforSafarioniPhone.html

UserAgent complete set

UserAgent complete set ssfari

codercat
  • 22,873
  • 9
  • 61
  • 85