Ticket #11229 (closed bug: wontfix)
iOS UIWebView detected as mozilla instead of webkit
| Reported by: | salomvary | Owned by: | |
|---|---|---|---|
| Priority: | undecided | Milestone: | None |
| Component: | unfiled | Version: | 1.7.1 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
jQuery loaded into iOS applications' embedded web browser view (UIWebView) detects the browser as mozilla instead of webkit. Example: links followed from Facebook app's news feed.
Expected:
$.browser.webkit === true
Got:
$.browser.webkit === undefined
$.browser.mozilla === true
UserAgent tested:
"Mozilla/5.0 (iPhone; U; CPU iPhone OS 5_0_1 like Mac OS X; en_US) AppleWebKit (KHTML, like Gecko) Mobile [FBAN/FBForIPhone;FBAV/4.1;FBBV/4100.0;FBDV/iPhone4,1;FBMD/iPhone;FBSN/iPhone OS;FBSV/5.0.1;FBSS/2; FBCR/Carrier;FBID/phone;FBLC/en_US;FBSF/2.0]"
Change History
comment:2 Changed 16 months ago by dmethvin
- Status changed from new to closed
- Resolution set to wontfix
I agree. Feature detection would definitely be your best bet. Since jQuery.browser is deprecated and this is a pretty rare situation, we aren't likely to fix it. Trying to craft a regexp in order to "fix" these situations is always hit or miss.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

The problem is that developers are free to change the user-agent to whatever they want, like Facebook has done. The jQuery browser UA regex depends on the webkit version number after AppleWebKit, if it doesn't find that, it goes through the possibilities, until it stops at mozilla. Of course the regex could be split up to first try to match the webkit and then the version number, but this is not sustainable, since that is only true on the Facebook app, other apps might change the user-agent differently. The only real fix, and what people should do anyway, is to not use user-agent and instead use feature testing.