English 中文(简体)
Does UIWebView send the same User-Agent in the Request Headers as mobile Safari?
原标题:

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 from mobile Safari would?

最佳回答

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
问题回答

Standalone mobile Safari user agent strings contain the word Version , whereas uiWebView user agent strings do not. So, the detection script can be modified to work with the latest version of iOS like so:

var is_uiwebview = /(iPhone|iPod|iPad).*AppleWebKit(?!.*Version)/i.test(navigator.userAgent);




相关问题
Code sign Error

I have created a new iPhone application.I have two mach machines. I have created the certificate for running application in iPhone in one mac. Can I use the other mac for running the application in ...

ABPersonViewController Usage for displaying contact

Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...

将音频Clips从Peter改为服务器

我不禁要问,那里是否有任何实例表明从Peit向服务器发送音响。 I m不关心电话或SIP风格的解决办法,只是一个简单的袖珍流程......

• 如何将搜查线重新定位?

我正试图把图像放在搜索条左边。 但是,问题始于这里,搜索条线不能重新布署。

热门标签