A
A
ArtemDanilkin2014-07-10 12:58:16
In contact with
ArtemDanilkin, 2014-07-10 12:58:16

How to add your own description and picture to the Vkontakte "Share" button?

I do everything according to the VK documentation, add to the head

<script type="text/javascript" src="http://vk.com/js/api/share.js?90" charset="windows-1251"></script>

I add code on the page of the site -
<script type="text/javascript">
document.write(VK.Share.button({
url: 'http://www.сайт.ru/',
title: 'Хороший сайт',
description: 'Это мой собственный сайт, я его очень долго делал',
image: 'url изображения',
noparse: true
}));
</script>

As a result, the title, description and picture are not taken from the ones that I asked, but from the page specified in the url.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
ArtemDanilkin, 2014-07-10
@ArtemDanilkin

I solved the issue by writing all the parameters in the url.

<script type="text/javascript">
document.write(VK.Share.button({url: 'http://Сайт/?title=&description=&image=&noparse=true'}));
</script>

T
T4-100, 2014-07-10
@isawillbenice

Try like this jsfiddle.net/822uR

S
Stepan, 2014-07-10
@L3n1n

This is how it worked for me..

<script type="text/javascript" src="http://vkontakte.ru/js/api/share.js?10" charset="windows-1251"></script>
<script type="text/javascript">/* <![CDATA[ */document.getElementById("vk").innerHTML = VK.Share.button(false,{type: "round", text: "Сохранить",title: "Скачать файл <?=$this->name?>", image: "<?=$vkimg?>", noparse: true});
/* ]]> */</script>

R
rianvi, 2017-03-03
@rianvi

And explanation of problem and solution with example

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question