ua-parser-js
ua-parser-js copied to clipboard
recognize iPadOS
iPadOS (Beta) has 2 UAs.
User Agent in Safari on iPadOS |Apple Developer Forums
current result
ua-parser-js 0.7.20
UA: ... (Macintosh; Intel Mac OS X 10_15) ...
os: {
name: "Mac OS",
version: "10.15"
}
UA: ... (iPad; CPU OS 13_0 like Mac OS X) ...
os: {
name: "iOS",
version: "13.0"
}
expected result
os: {
name: "iPadOS",
version: "13.0"
}
We have also come across this issue. Here are some example user agents since Apple moved to iPadOS:
Before (in a web view in an app)
Mozilla/5.0 (iPad; CPU OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148
After (in a web view in an app)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15) AppleWebKit/605.1.15 (KHTML, like Gecko)
After (in full-fat Safari)
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
Is there a plan to add support for iPadOS?
We have the same issue: Platform: iOS Safari on iPad with iOS 13.2.3 Expected behavior: device says iPad Observed behavior: device is empty
We have also come across this issue. Here are some example user agents since Apple moved to iPadOS:
Before (in a web view in an app)
Mozilla/5.0 (iPad; CPU OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148
After (in a web view in an app)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15) AppleWebKit/605.1.15 (KHTML, like Gecko)
After (in full-fat Safari)
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
Is there a plan to add support for iPadOS?
I have the exact same string when looking at whatsmyua.info with my iPad. Interestingly, the ua string is the exact same as on my MacOS. So only by looking at the ua string, one cannot detect an iPad.
Since I need this information in my use case, my workaround looks like this:
export const hasDynamicKeyboard = () => {
const parser = new UAParser();
const { name: osName } = parser.getOS();
// Workaround for iPadOS which is currently not detectable via UA
const iPadOS = window.orientation !== undefined && osName === 'Mac OS';
return osName === 'iOS' || iPadOS;
};
Even though MDN deprecated the window.orientation
variable, mobile devices still support it which is a good temporary solution I guess.
According to https://www.theiphonewiki.com/wiki/Models you need to look for this UA, which from time to time tend to update: server-bag [iPhone OS,13.3,17C54,iPhone8,1]
if you look up iPhone8,1 in the above webpage you know that it is an iPhone 6s.
I have extracted as an example all the server-bag UA our system logged this week.
/cfg/system/root # pcb_cli Devices.Device? | grep UserAgent | grep -i server Devices.Device.90:81:2A:2E:A0:73.UserAgents.captiveportal-2.UserAgent=server-bag [Watch OS,6.1.2,17S796,Watch5,2] Devices.Device.90:81:2A:2E:A0:73.UserAgents.captiveportal-3.UserAgent=server-bag [Watch OS,6.1.3,17S811,Watch5,2] Devices.Device.A0:B5:49:00:6A:30.UserAgents.captiveportal-8.UserAgent=server-bag [iPhone OS,13.3.1,17D50,iPhone8,1] Devices.Device.F4:5C:89:8C:37:87.UserAgents.captiveportal-4.UserAgent=server-bag [Mac OS X,10.14.5,18F132,MacBookPro12,1] Devices.Device.A4:F1:E8:27:7D:B2.UserAgents.captiveportal-1.UserAgent=server-bag [iPhone OS,13.3.1,17D50,iPhone8,4] Devices.Device.BC:E1:43:CC:C6:A7.UserAgents.captiveportal-2.UserAgent=server-bag [iPhone OS,13.3.1,17D50,iPhone8,4] Devices.Device.2C:F0:A2:A1:0A:98.UserAgents.captiveportal-3.UserAgent=server-bag [iPhone OS,13.3,17C54,iPhone8,4] Devices.Device.A4:5E:60:C5:28:23.UserAgents.captiveportal-5.UserAgent=server-bag [Mac OS X,10.14.5,18F132,MacBookPro12,1] Devices.Device.04:4B:ED:14:58:AF.UserAgents.captiveportal-1.UserAgent=server-bag [iPhone OS,13.3.1,17D50,iPhone8,1] Devices.Device.98:CA:33:60:B9:C0.UserAgents.captiveportal-6.UserAgent=server-bag [iPhone OS,13.3.1,17D50,iPhone9,1] Devices.Device.AC:CF:5C:7D:45:B2.UserAgents.captiveportal-3.UserAgent=server-bag [iPhone OS,12.4.2,16G114,iPad4,1] Devices.Device.88:E9:FE:50:94:87.UserAgents.captiveportal-2.UserAgent=server-bag [Mac OS X,10.14.6,18G3020,MacBookPro14,1]
Unlike iphones, iPads have full screen support. Could be useful for detecting ipados
For iPad, I get following ua :
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.4 Safari/605.1.15
So it recognize os : MacOS ans browser Safari (instead of iPadOS and Safari mobile)
But how do you distinguish it from Desktop Safari?
On Sun, Apr 26, 2020, 6:42 PM vykimo [email protected] wrote:
For iPad, I get following ua :
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.4 Safari/605.1.15
So it recognize os : MacOS ans browser Safari (instead of iPadOS and Safari mobile)
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/faisalman/ua-parser-js/issues/387#issuecomment-619582329, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAITXB3QHU2GN5C6JESR5O3RORP65ANCNFSM4INRAQTQ .
But how do you distinguish it from Desktop Safari? … On Sun, Apr 26, 2020, 6:42 PM vykimo @.***> wrote: For iPad, I get following ua : Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.4 Safari/605.1.15 So it recognize os : MacOS ans browser Safari (instead of iPadOS and Safari mobile) — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#387 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAITXB3QHU2GN5C6JESR5O3RORP65ANCNFSM4INRAQTQ .
Currently it's my question? It has similar UA as desktop
any news?
https://stackoverflow.com/questions/9038625/detect-if-device-is-ios
I found that on iPad, if I go to Safari settings there is a setting for "Request Desktop Website". After setting this to false, the iPad device detection worked.
So I guess it depends on how much you want to respect the user's "Request Desktop Website" setting.
@TomTirapani Setting that doesn't work for me in my case running iOS 13.5.1
I learnt that apple has frozen the Safari user agent for some time and starting with iOS 13, on WKWebView-based solutions (e.g. Safari), iPad was removed so that iPadOS can have a full desktop class experience. The next step is what Google is doing and removing the user agent entirely (in other words, both companies have told developers "do not use the user agent"). See https://groups.google.com/a/chromium.org/forum/m/#!msg/blink-dev/-2JIRNMWJ7s/yHe4tQNLCgAJ
Anyone have an update workaround on this?
There are less information on safari on an ipad as far as it was mentioned. Chrome with this lib can recognice that we are on an ipad. Our workaround is smth like, if the type is not recogniced AND we have a specific resolution AND we are on safari then we can guess that we are on a device which is smaller than a normal PC. And if we have the newest iPad with width over 1300, we can show the version that we ususally have on a desktop, because it should be big enough.