Facebook share of my blogger blog shows some javascript coding

Submitted by Ramakrishnan on Nov 29, 2011 - 11:22

My blogger blog shows some javascript text when I am sharing it in facebook as like below..

var mydate=new Date() var year=mydate.getYear() if (year <​ 1000) year+=1900 var day=mydate.getDay() var month=mydate.getMonth() var daym=mydate.getDate() if (daym<​10) daym="0"+daym var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday") var montharray=new Arr…

What be the problem?


Nov 29, 2011 - 19:36

Move javascript to header

Facebook sharing detects the first <p> tag in your page from the link. Then shows the text in the sharing status page.

In your case, the problem is with your template, edit your template and move the javascript block to header.

You may include it in a function and call it in body onload event. Include the below before tag:

i.e., Include the below code above the </head> tag:

Change the <body> tag

Include id 'dispdate', where you want to display date.