Closed darasus closed 1 year ago
@faisalman hm but Klarna app is positioned as Shopping Browser, it has URL address bar etc. Attached a screenshot of how it looks. Would that still count as non browser?
Hey @faisalman, thanks for merging this PR! Is this going to v1 or v2?
v2, but might as well backported to v1 later
@faisalman how can we add this to v1?
In the mean time, you can pass it as an extension when instantiating UAParser
const browsers = [
[/(klarna)\/([\w\.]+)/i], [UAParser.BROWSER.NAME, UAParser.BROWSER.VERSION]
];
const parser = new UAParser({ browser: browsers });
const ua = 'Mozilla/5.0 (Linux; Android 12; moto g(60)s Build/S3RLS32.114-25-13; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/116.0.0.0 Mobile Safari/537.36 Klarna/23.36.215';
uap.setUA(ua).getBrowser(); // { name: 'Klarna', version: '23.36.215', major: '23'}
More details at https://docs.uaparser.js.org/v2/intro/extending-regex.html
Klarna App with 150 million users is rather popular shopping browser.
Adding support for Klarna UA parser.