I am using a script on my blogger blog which uses externally source images with previous and next button. The script include currentUrl function to create a page impression whenever next or previous button is clicked.
I want to add facebook share button, which enables a user to share the picture they are viewing, but i believe it cant be done,because i tried to copy paste the link on the address bar (which changes with picture due to currentUrl function) on facebook but it couldn't retrieve the image associated with url, is it possible to make any changes to the script so that images can be shared social media? Help would be much appreciated. Thanks
HTML Code:
<body onload="showPicNo(a)">
<div id="picture"><img name="picturegallery"></div>
<div id="navigation">
<a href="javascript:bw()">previous</a> | <a href="javascript:fw()">next</a>
</div>
<body>
javascript code:
var pics=new Array ("http://4.bp.blogspot.com/_UdzqQpb36Jo/R9kVS0h1BFI/AAAAAAAAD_o/SRGugAQSF0A/s1600/timming_pictures_37.jpg","https://lh3.googleusercontent.com/-et1BbdI-Dqk/UbM0JNa5VSI/AAAAAAAAAdw/cd6yN5HWvmc/s480-no/Funny+Lady+French+Kiss+With+Lion.jpg","https://lh3.googleusercontent.com/-pSwjTBzFDM0/UbMukN2vTbI/AAAAAAAAAbc/ZMLSTtO-JUk/w460-h511-no/funny-pictures-auto-woman-boobs-477558.jpeg")
var a=0;
var b = pics.length;
var currentUrl = document.URL;
var existsPicParameter = currentUrl.match(/picnoparam\S*/i);
var tmpPicParameter, tmpPicParameterOld;
if (existsPicParameter != null)
{
tmpPicParameter = existsPicParameter[0].match(/picnoparam=\d+/i);
if (tmpPicParameter != null)
{
a = parseInt(tmpPicParameter[0].match(/\d+/i));
tmpPicParameterOld = tmpPicParameter[0];
}
} else {
a = Math.floor(Math.random() * (b - a)) + a;
}
function fw()
{
if (a == (b - 1))
{
a = 0;
} else {
a++;
}
navigate(a);
}
function bw()
{
if (a == 0)
{
a = b - 1;
} else {
a--
}
navigate(a);
}
function navigate(a)
{
if (existsPicParameter == null)
{
if (currentUrl.indexOf("?") == -1)
{
currentUrl += "?";
} else {
currentUrl += "&";
}
currentUrl += "picnoparam="+a;
} else {
tmpPicParameter[0] = tmpPicParameter[0].replace(/\d+/i,a);
currentUrl = currentUrl.replace(tmpPicParameterOld,tmpPicParameter[0]);
}
window.location.replace(currentUrl);
}
function showPicNo(picNumber)
{
window.document.images["picturegallery"].src=pics[picNumber];
}
function randomPicture()
{
erg = Math.floor(Math.random() * (b - a)) + a;
showPicNo(erg);
}