Search code examples
phpiosipadhttp-referer

PHP mobile detection with new iPadOS/iOS 13


I was wondering if there was any documentation or any new libraries which can detect the new iPadOS / iOS 13?

They used to output:

mozilla/5.0 (ipad; cpu iphone os 12_1_3 like mac os x) applewebkit/605.1.15 (khtml, like gecko) version/12.0 mobile/15e148 safari/604.1

But are now outputting:

mozilla/5.0 (macintosh; intel mac os x 10_15) applewebkit/605.1.15 (khtml, like gecko) version/13.0.1 safari/605.1.15

Has anyone come across this? Any new libraries to use?


Solution

  • Best I got as a solution was to use javascript:

    // iPad check
    if( (window.screen.height / window.screen.width == 1024 / 768) || 
        (window.screen.height / window.screen.width == 1112 / 834) ||
        (window.screen.height / window.screen.width == 1366 / 1024)
    ) {
        // do stuff here
    }
    

    Not as perviously intended, but the best solution I have.