top

Detecting Platform

This document covers userAgent, how to detect platform and etc.

Overview

Several API specifications and features are a little different in Samsung TV Products. You need to detect platforms for supporting some features or resolving some issues that depend on platform.
For detecting platform, please refer to the following.

Using userAgent

By using navigator.userAgent, you can get the value of platform information.
For more details, refer to web standard API on userAgent.

var userAgent = navigator.userAgent
console.log(userAgent);

The following is the format of navigator.userAgent.

```
Mozilla/$(MOZILA_VER)
($(DEVICE_TYPE); $(OS); $(PLATFORM) $(PLATFORM_VER) SAMSUNG $(MODEL_NAME))
AppleWebKit/$(APPLEWEBKIT_VER)
(KHTML, like Gecko) 
$(APP_NAME)/$(APP_VER)
$(UX RECOMMEND)
Safari/$(SAFARI_VER)
```
Table 1. Format of navigator.userAgent
Field Description Required
$(DEVICE_TYPE) “SMART-TV” is used Optional
$(PLATFORM)
$(PLATFORM_VER)
“Tizen” is used Mandatory
SAMSUNG It is company name Optional
$(MODEL_NAME) “sdk” is used for Samsung TV SDK Optional
$(APP_NAME)/$(APP_VER) “version/xxx” is used most of all. Mandatory
$(UX_RECOMMEND) “TV” is used Optional

The following table is the value of navigator.userAgent by Samsung TV Products.

Table 2. value of navigator.userAgent
Product User Agent
TV 2017 Mozilla/5.0 (SMART-TV; LINUX; Tizen 3.0) AppleWebKit/538.1 (KHTML, like Gecko) Version/3.0 TV Safari/538.1
TV 2016 Mozilla/5.0 (SMART-TV; Linux; Tizen 2.4.0) AppleWebKit/538.1 (KHTML, like Gecko) Version/2.4.0 TV Safari/538.1
TV 2015 Mozilla/5.0 (SMART-TV; Linux; Tizen 2.3) AppleWebkit/538.1 (KHTML, like Gecko) SamsungBrowser/1.0 TV Safari/538.1
TV SDK 3.0 Mozilla/5.0 (SMART-TV; LINUX; Tizen 3.0) AppleWebKit/538.1 (KHTML, like Gecko) Version/3.0 TV Safari/538.1
TV SDK 2.4 Mozilla/5.0 (SMART-TV; Linux; Tizen 2.4.0; SAMSUNG sdk) AppleWebKit/538.1 (KHTML, like Gecko) Version/2.4.0 TV Safari/538.1
TV SDK 2.3.1 Mozilla/5.0 (SMART-TV; Linux; Tizen 2.4.0; SAMSUNG sdk) AppleWebKit/538.1 (KHTML, like Gecko) Version/2.4.0 TV Safari/538.1

For comparison, the following table is that of Chrome browser.

Table 3. Comparison with Chrome browser
Browser User Agent
Chrome 57.0.2987.110 Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36

Getting Platform Information

There are two types of platform information.

  • Samsung TV information
    By using Samsung Product API, you can get Samsung TV information.
    You can get more information on ProductInfo API.

    var firmware = webapis.productinfo.getFirmware();
    console.log(firmware);
    
    var model = webapis.productinfo.getModel();
    console.log(model);
    
  • Tizen platform version
    By using Tizen API, you can get Tizen platform version.
    You can get more information on SystemInfo API.

    var capability = tizen.systeminfo.getCapability('http://tizen.org/feature/platform.version');
    console.log(capability);