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

后端 未结 2 625
谎友^
谎友^ 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:38

    This will load the initial comments box, the script will when executed will clear the comments div wrapper and replace html5 comments box with new url. JS SDK will then parse the new box.

    JS SDK is required for this work. refer to https://developers.facebook.com/docs/reference/javascript/

    fix for xfbml render from dom manipulation



    user solved:

    document.getElementById('comments').innerHTML='
    '; FB.XFBML.parse(document.getElementById('comments'));

提交回复
热议问题