Friday 15 August 2014

javascript - Add rel="nofollow" to facebook comments -



javascript - Add rel="nofollow" to facebook comments -

does know, how can add together rel="nofollow" attribute links in comments plugin facebook.

<div id ="comments" style="margin-left: 510px; width: 550px" > <div class="fb-comments" data-href="http://my.net/" data-width="550" data-numposts="5" data-colorscheme="light"></div> </div> </div> window.addeventlistener("load", func, false); function func() { var div = document.getelementbyid("comments"); var elements = div.getelementsbytagname("*"); (var = 0; < elements.length; i++) { if (elements [i].tagname == "a") { elements[i].rel = "nofollow"; } } }

array elements not contain tags facebook adds in .

if (elements[i].tagname.tolowercase() == "a") { elements[i].setattribute('rel', 'nofollow'); }

and must paste code after fb init, not on window.load.

javascript facebook comments

No comments:

Post a Comment