Check if iOS version is 3.0 or higher with PHP or Javascript

后端 未结 4 1094
清酒与你
清酒与你 2021-01-23 22:59

I need to check if an iOS device visiting my Website has iOS 3.0 or higher installed. Can I do that?

4条回答
  •  执笔经年
    2021-01-23 23:42

    Bit of an older question, but I believe none of the answers currently given answer the question appropriately.

    If you want to do something like

    if(iOS_version > 3){
        // Open something
    }
    

    Then I believe you are looking for

    if(/(iPhone|iPad|iPod)\sOS\s3/.test(navigator.userAgent)) {
        // use apple maps
    }
    

    Where s3 is looking for iOS3. Change s3 to s9 to check for iOS9

提交回复
热议问题