- A3 script에서 useragent를 이용해 현재 단말기로 로그인한 것인지 PC에서 로그인한 것인지 결정
- ua-parser-js 오픈 소스 사용해서 useragent를 파싱
npm install --save-dev ua-parser-js
import * as uaParserJS from 'ua-parser-js';
해서 사용
- 작업한 git commit
- /js/util/aceUtils.js
- 어떤 webview 인지 문자열로 sync로 리턴
- 브라우져일경우
{"ua":"Mozilla/5.0 (Linux; Android 7.0; SM-N920S) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Mobile Safari/537.36","browser":{"name":"Chrome","version":"71.0.3578.98","major":"71"},"engine":{"name":"WebKit","version":"537.36"},"os":{"name":"Android","version":"7.0"},"device":{"vendor":"Samsung","model":"SM-N920S","type":"mobile"},"cpu":{}}
{"ua":"Mozilla/5.0 (Linux; Android 7.0; SAMSUNG SM-N920S Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/7.4 Chrome/59.0.3071.125 Mobile Safari/537.36","browser":{"name":"Samsung Browser","version":"7.4","major":"7"},"engine":{"name":"WebKit","version":"537.36"},"os":{"name":"Android","version":"7.0"},"device":{"vendor":"Samsung","model":"SM-N920S","type":"mobile"},"cpu":{}}
{"ua":"Mozilla/5.0 (Linux; Android 7.0; SM-N920S Build/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/71.0.3578.98 Mobile Safari/537.36","browser":{"name":"Chrome WebView","version":"71.0.3578.98","major":"71"},"engine":{"name":"WebKit","version":"537.36"},"os":{"name":"Android","version":"7.0"},"device":{"vendor":"Samsung","model":"SM-N920S","type":"mobile"},"cpu":{}}
{"ua":"Mozilla/5.0 (iPhone; CPU iPhone OS 12_1_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0 Mobile/15E148 Safari/604.1","browser":{"name":"Mobile Safari","version":"12.0","major":"12"},"engine":{"name":"WebKit","version":"605.1.15"},"os":{"name":"iOS","version":"12.1.1"},"device":{"vendor":"Apple","model":"iPhone","type":"mobile"},"cpu":{}}
{"ua":"Mozilla/5.0 (iPhone; CPU iPhone OS 12_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/71.0.3578.89 Mobile/15E148 Safari/605.1","browser":{"name":"Chrome","version":"71.0.3578.89","major":"71"},"engine":{"name":"WebKit","version":"605.1.15"},"os":{"name":"iOS","version":"12.1"},"device":{"vendor":"Apple","model":"iPhone","type":"mobile"},"cpu":{}}
{"ua":"Mozilla/5.0 (iPhone; CPU iPhone OS 12_1_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/16C50","browser":{"name":"WebKit","version":"605.1.15","major":"605"},"engine":{"name":"WebKit","version":"605.1.15"},"os":{"name":"iOS","version":"12.1.1"},"device":{"vendor":"Apple","model":"iPhone","type":"mobile"},"cpu":{}}
{"ua":"Mozilla/5.0 (iPhone; CPU iPhone OS 12_1_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/16C50","browser":{"name":"WebKit","version":"605.1.15","major":"605"},"engine":{"name":"WebKit","version":"605.1.15"},"os":{"name":"iOS","version":"12.1.1"},"device":{"vendor":"Apple","model":"iPhone","type":"mobile"},"cpu":{}}