简体   繁体   中英

Switch Facebook Comments without reloading a website

I have a website "web.html", which contains 50 topics. At the top, the user clicks a topic. Then, Facebook comments should appear with the discussion of the topic.

I use this plugin: https://developers.facebook.com/docs/plugins/comments/

Everything works well, when I insert comments into a webpage directly:

<div class="fb-comments" data-href="//web.com/web.html#topic=0" data-width="600" data-numposts="5"></div>

But I want the user to be able to switch the topics at the top, and the comment section should be updated with comments about the new topic, without reloading a website. Is it possible?

I made a separate HTML webpage with Facebook comments only. This page gets the ID of comments at the end of the URL.

The webpage with comments is inserted into the main webpage with an iframe. So when I need to show comments for a different topic, I just change the URL of the iframe.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM