Reputation: 1407
I have 1000 posts and want to put facebook comments on every page. The facebook plguin requires a url value
inside the href
attribute. I don't want to manually put the url 1000 times.
There are certain ways like putting expr:href='data:post.canonicaUrl'
in blogger.However, i am putting the code outside the main wrapper,hence blogger is unable to catch up the post url.
Is there anyway in which the href
attribute automatically catches up the value of the address bar url.
Upvotes: 0
Views: 344
Reputation: 43156
Following script will replace the href
attribute of all anchor tags with the current url
var anchors = document.getElementsByTagName('a');
for(var i=0;i<anchors.length;i++)
anchors[i].href = window.location.href;
Upvotes: 1