简体   繁体   中英

How to identify Roku Tv Device in code level (HTML/JavaScript) ..?

I have developed a Roku Tv application.That app is for Roku. I need to identify what is the currently accessing device.

How can I do this using HTML/JavaScript..?

Thanks

You can identify them using the user agent string.

roku devices has a user-agent string something like this

Mozilla/5.0 (compatible; U; NETFLIX) AppleWebKit/533.3 (KHTML, like Gecko) Qt/4.7.0 Safari/533.3 Netflix/3.2 (DEVTYPE=RKU-42XXX-; CERTVER=0) QtWebKit/2.2, Roku 3/7.0 (Roku, 4200X, Wireless)

you can access the user agent string with this in js

is_a_roku =  function (){
   let user_agent = navigator.userAgent;
   return user_agent.indexOf("Roku") != -1
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM