Social plugins re-parsing
You might need to change the link of the like/share buttons in your page in real time.
In this case you need to reload the social plugin using the following methods.
// Twitter
twttr.widgets.load();
// Facebook
// general to all elements in the page
FB.XFBML.parse();
// single element with an id
FB.XFBML.parse(document.getElementById('element_id'));
// G+
gapi.plusone.render('element_id', {
'size' : 'medium'
// options as you need them
});
//Pinterest
$.ajax({ url: 'http://assets.pinterest.com/js/pinit.js', dataType: 'script', cache:true});
Written by Paolo
Related protips
Have a fresh tip? Share with Coderwall community!
JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.
Security insights from Cside