ChatGPT解决这个技术问题 Extra ChatGPT

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

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).]


7
7 revs, 6 users 48%

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

Does safari on IOS receive updates? If so, would it be an idea to both list the stock version included with the device, as well as the final update or most recent supported version of Safari for each device/IOS?
As far as I'm aware, Safari updates are only delivered as iOS updates.
K
Kevin Borders

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"


the second link is dead.
You can go to the main page instead: useragentstring.com I hope this gonna last longer.
E
Elis Byberi

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


This actually shows the user agent strings for iOS version, which I can tie back to a version of webkit. This is good enough!
The first link is dead.
t
tkone

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


yes! Feature detection is important and is the correct way to test for functionality. However, I'm trying to cut a feature from jQuery for version 1.8 bugs.jquery.com/ticket/10996 and I can remove large swathes of code if I can verify that getBoundingClientRect exists in all of the browsers that jQuery supports. For example, you wouldn't feature detect document.createElement(), would you? I'm trying to find out if getBoundingClientRect is mature enough to no longer warrant a support test for it and the 4 other support tests it's potentially unnecessary fallback requires. Thanks!
For a bit more context, here's the pull request I've submitted that warranted the question. github.com/jquery/jquery/pull/642
aah i get it. i don't think the list you're looking for exists in a meaningful way though. this might be one of those things where you have to download the old SDKs and run it in the simulator. or, since the mobile version is supposed to be identical to a desktop build (ie 10.7's safari 5.1 is supposed to be the same as iOS 5.1 safari), you could do some mapping. Didn't mean my comment to be snarky, btw :)
This might be of some help: en.wikipedia.org/wiki/JavaScript, but it's pretty difficult to find solid information on this. Merry christmas!
downvoted: good advice per se but completely unrelated to the question. Need to support particular browser may come as a requirement, or may need to be documented. That's another topic.
f
frosty

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!