我不知道飞利浦电视浏览器是如何工作的,但最顺理成章的事情来尝试首先将是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>
更新问题:有关浏览器添加的信息 –
好吧,你可以看到用户代理包含单词“飞利浦”,所以你也许可以用它来识别当电视看你的页。 – hampusohlsson
@IvanSolntsev你做到了吗? – hampusohlsson