What version of mobile safari comes with each version of iOS?

JavascriptIosWebkitMobile Safari

Javascript Problem Overview


I'm trying to figure out what Javascript APIs I can use to achieve support for Mobile Safari back to iOS2. I haven't found a list anywhere that shows what version of Mobile Safari ships with each new version of iOS. I'm looking for a comprehensive list that goes all the way back to iOS2.

Thanks!

[Edit: Yes, I know and love feature detection. However, I have a set of targeted browsers I need to support, and I just need to verify that the fallbacks I provided cover my target audience and that I don't need to provide additional fallbacks that are cumbersome hacks).]

Javascript Solutions


Solution 1 - Javascript

Since this is already the top hit on Google, we should start a list here. I'll make this answer a community wiki. By the way, I'm pulling these from the device's user agent string. Browser version is iOS version dependent, NOT device dependent. But when a phone doesn't support higher iOS versions it is listed:

3.2.2    - Mobile Safari 4.0.4
4.3.3    - Mobile Safari 5.02   - iPhone 3g
5.0      - Mobile Safari 5.1
5.1      - Mobile Safari 5.1
6.0      - Mobile Safari 6.0    - iPhone 3gs
7.1      - Mobile Safari 7.1    - iPhone 4
8.3      - Mobile Safari 8.0
9.2.1    - Mobile Safari 9.0    - iPhone 4s
10.3.4   - Mobile Safari 10.0   - iPhone 5
11.2.5   - Mobile Safari 11.0
12.1.4   - Mobile Safari 12.0
12.4.4   - Mobile Safari 12.1   - iPhone 5S, 6
13.0     - Mobile Safari 13.0
[...]    - [...]
15.2     - Mobile Safari 15.2

Solution 2 - Javascript

This guy's list is really useful: http://www.somegeekintn.com/blog/stuff/iosvers/

If you need the additional info, you can decode the Safari versions on useragentstring.com, e.g:

http://www.useragentstring.com/Safari5.0.2_id_18120.php explains that Safari version 6533.18.5 is known as "Safari 5.0.2"

Solution 3 - Javascript

I couldn't find a comprehensive list either. The best thing I've found so far is some Safari documentation from Apple:

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

Good luck!

[Update]

While this still doesn't answer the question it at least tells when WebKit added support for getBoundingClientRect() in Febuary of 2009.

http://trac.webkit.org/changeset/40837

Solution 4 - Javascript

Rather than doing device or os detection, you should be doing feature detection -- it'll provide a much richer experience, and you can provide custom code to add functionality that the specific version doesn't support. This way you'll provide support way beyond the specific devices you're targeting (and it usually ends up being easier since rather than branching your code for a specific user-agent, you're back-filling support for older js implementations by providing forward-looking support on a conditional basis).

For example, the latest version of desktop & mobile Safari do not provide .bind() functionality to bind a context to a closure. This can be detected and handled using Function.prototype.bind and if it doesn't exist, providing an implementation that provides the functionality to older browsers. Using a library like http://www.modernizr.com/ will assist greatly in this endeavor.

That being said there are some specific DOM events which are tied to certain versions of iOS: http://developer.apple.com/library/safari/navigation/#section=Libraries&topic=Safari%20DOM%20Additions%20for%20iOS

Solution 5 - Javascript

If there are specific API's that you are looking at, caniuse.com is a great resource for finding out how far back the API has support.

Good luck with it!

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMike SherovView Question on Stackoverflow
Solution 1 - JavascriptAlex WView Answer on Stackoverflow
Solution 2 - JavascriptIzabela EweView Answer on Stackoverflow
Solution 3 - JavascriptJoelView Answer on Stackoverflow
Solution 4 - JavascripttkoneView Answer on Stackoverflow
Solution 5 - JavascriptfrostyView Answer on Stackoverflow