HTML5 Dev Gal

Messing with HTML5, CSS3 and JavaScript.

JavaScript for Samsung SmartTV Browser Detection

| Comments

UPDATE:

This is better achieved with a Modernizr plugin called Detectizr. Use that instead. I’ll keep the rest of this info for reference.

Here’s the code to determine if the current browser is a SmartTV - requires Modernizr

Using Modernizr
function isSmartTV() {
    return Modernizr.websockets === false;
}

This works because the Samsung SmartTV does not support Web Sockets which I find out by running the Modernizr Test Suite on the SmartTV.

UPDATE:

Actually I wound up changing this to use User-Agent sniffing based on a great discussion I had with Derek Anderson

User-Agent Sniffing
function () {
    return navigator.userAgent.search(/TV/i) >= 0;
}

Comments