Does UIWebView send the same User-Agent in the Request Headers as mobile Safari?

后端 未结 2 1102

Sorry, I would just test this myself, but I\'m currently without my mac. Does a web request made inside of a UIWebView send the same user-agent info that a web request made

2条回答
  •  情歌与酒
    2020-12-01 02:39

    Web requests made from UIWebView will not include the word "Safari" in the User Agent string. Web requests made from Mobile Safari will. This is the best way I have found for determining of a request is coming from within an app or from Mobile Safari.

    Sample User Agent from UIWebView within App:

    User-Agent: Mozilla/5.0 (iPad; U; CPU OS 4_3_2 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Mobile
    

    Sample User Agent from Mobile Safari:

    User-Agent: Mozilla/5.0 (iPad; U; CPU OS 4_3_2 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8H7 Safari
    

提交回复
热议问题