How Viber select the image to display from HTML page

我只是一个虾纸丫 提交于 2019-12-09 18:22:38

问题


when I send some URL to someone via Viber the Viber load the URL and displays image representing the HTML page.

How to tell the HTML page what image it should be?


回答1:


You should use Open Graph protocol. You can simply add this snippet to your page <head>:

<meta property="og:type" content="website">
<meta property="og:site_name" content="Название сайта">
<meta property="og:title" content="Заголовок">
<meta property="og:description" content="Описание.">
<meta property="og:url" content="http://example.com/page.html">
<meta property="og:locale" content="ru_RU">
<meta property="og:image" content="http://example.com/img.jpg">
<meta property="og:image:width" content="968">
<meta property="og:image:height" content="504">

<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="Заголовок">
<meta name="twitter:description" content="Описание.">
<meta name="twitter:image:src" content="http://example.com/img.jpg">
<meta name="twitter:url" content="http://example.com/page.html">
<meta name="twitter:domain" content="example.com">
<meta name="twitter:site" content="@">
<meta name="twitter:creator" content="@...">

Image size should be 968x504px. Read more here

Cheers!




回答2:


I believe that Viber takes the first picture it finds from your website (backgrounds not included!). I have made some tests and have found out that if you place an image in a comment section at the top of your HTML - <!-- <img src='myImg.jpg'/>--> - it will also accept it as a first image file in your source code. Thus you can put whatever image you like.



来源:https://stackoverflow.com/questions/34941283/how-viber-select-the-image-to-display-from-html-page

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!