2015-10-06 108 views
4

我想为飞利浦电视(NETTV模型)浏览器中的页面提供我自己的预览图像。 它显示在历史页​​面地址附近。飞利浦电视浏览器如何获取页面的预览图像?

我该怎么办?

enter image description here (图像从avforum,从谷歌搜索获得的)

飞利浦电视机使用Opera 11.6如浏览器。 的userAgent字符串是:

Opera/9.80 (Linux mips; U; HbbTV/1.1.1 (; Philips; ; ; ;) CE-HTML/1.0 NETTV/4.0.2; en) Presto/2.10.250 Version/11.60 

回答

5

我不知道飞利浦电视浏览器是如何工作的,但最顺理成章的事情来尝试首先将是og:image标签,看看电视选了。

<meta property="og:image" content="http://example.com/image.png"/> 

如果没有,那么电视可能使用了一些屏幕截图库。您可以尝试此解决方法以获得所需的行为:

首先,找出您的电视的用户代理。例如,从电视机浏览到http://whatsmyuseragent.com/

然后在您的页面上创建一个检查用户代理的小脚本,如果它是电视,则将预览图片显示为叠加几秒钟。

希望电视会截取页面的初始渲染,然后您的电视会显示。

function hideSplash() { 
 
    document.getElementById("tv-splash").style.display = "none"; 
 
} 
 

 
// Remove '|Mozilla' when development is ready 
 
if (/Philips|Mozilla/.test(navigator.userAgent)) { 
 
    setTimeout(hideSplash, 2000); 
 
} else { 
 
    hideSplash(); 
 
}
#tv-splash { 
 
    position: absolute; 
 
    top: 0; 
 
    left: 0; 
 
    width: 100%; 
 
    height: 100%; 
 
    background: #f00 url(http://i.imgur.com/IonCAf7.jpg) center center no-repeat; 
 
    background-size: 50%; 
 
    z-index: 1; 
 
}
<div id="tv-splash"></div> 
 
<h1>My website</h1>

+0

更新问题:有关浏览器添加的信息 –

+0

好吧,你可以看到用户代理包含单词“飞利浦”,所以你也许可以用它来识别当电视看你的页。 – hampusohlsson

+0

@IvanSolntsev你做到了吗? – hampusohlsson