Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

navigator.userAgent on Mac OS X Captive Network Assistant returns null name property #148

Open
gabefinch opened this issue Feb 28, 2018 · 0 comments

Comments

@gabefinch
Copy link

gabefinch commented Feb 28, 2018

The Apple CNA is a version of Safari with some functionality stripped out which the OS pops open when it detects that the user is in a 'captive network'. In working with the Apple CNA on both iOS and OSX we discovered that platform.js has irregular behavior on the OSX CNA.
The specific navigator.userAgent string on the device CNA we are testing is:
Mozilla/5.0 (Macintosh; Intel Mac OSX 10_13) AppleWebKit/604.1.38 (KHTML, like Gecko)
Some of the parsing works, but description and name are not assigned correctly (description is identical to the userAgent string, name is null). In glancing at the platform.js source code I don't know how to fix this, as the userAgent string in this situation doesn't seem to specify enough about the context (shame on Apple).

Things work better on the iOS CNA where description and name convey that the user is on Safari on an iPhone. Example iOS CNA userAgent: Mozilla/5.0 (iPhone; CPY iPhone OS 10_3_3 like Mac OS X) AppleWebKit/603.3.8 (KHTML, like Gecko) Mobile/14G60 Looks like line 643 is catching that we are on iPhone and assuming we must be on something like Safari.
else if (/^iP/.test(product)) { ... }
Perhaps something similar could be done checking os.family for 'OS X' and assuming Safari if no better match.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

2 participants