bowser-js / bowser

a browser detector
Other
5.52k stars 487 forks source link

Can't detect Smart TVs #464

Open burakbas opened 3 years ago

burakbas commented 3 years ago

Bowser.parse platform output is empty when parsing Smart TV User Agents. I used example user agent strings in this URL. https://developers.whatismybrowser.com/useragents/explore/operating_platform/smart-tv/

Example code

var ua = "Mozilla/5.0 (SMART-TV; Linux; Tizen 2.4.0) AppleWebkit/538.1 (KHTML, like Gecko) SamsungBrowser/1.1 TV Safari/538.1";
var parsedResult = bowser.parse(ua);
console.log(parsedResult);

// outputs
{
  browser: {
    name: "Samsung Internet for Android"
    version: "1.1"
  },
  os: {
    name: "Tizen"
    version: "2.4.0"
  },
  platform: {
  },
  engine: {
    name: "WebKit"
    version: "538.1"
  }
}

// expected output
{
  browser: {
    name: "Samsung Internet for Android"
    version: "1.1"
  },
  os: {
    name: "Tizen"
    version: "2.4.0"
  },
  platform: {
   type: "tv"
  },
  engine: {
    name: "WebKit"
    version: "538.1"
  }
}