How to dynamically change facebook comments plugin url based on javascript variable?

后端 未结 2 626
谎友^
谎友^ 2021-01-18 08:06

I want to dynamically change the data-href for the fb comments plugin below based on a javascript variable. I\'m running a flash swf file and am passing the new link for da

2条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-18 08:41

    I found the simplest and effective way to make your Facebook Comment box to recognize the individual URL of each page (particularly good for e-commerce sites).

    Add this script to your top header portion of your website template (it generates de data-href value for your Comment Box div:

    
    

    And then on your Comment Box div, add the id for the value generated on the javascript:

    Voilá. I dedicated so much time to crack this nut, I just had to share it for you to save some time for break! Cheers!

提交回复
热议问题