On a page that contains a list of about 30 entries, each of them is Facebook-likable (each entry's HTML contains a Like button), and each of them is either displayed or not (depends on a filter setting):
On a PC with more than 1 GHz and 1 GB mem, the page is unusable because it is so slow (browser: Chromium). How can I change this, keeping the Like buttons?
Use the JavaScript SDK
Make sure to include the like buttons via xfbml and the JavaScript SDK. This way you have more control over them.
Don't load them initially, load them explicitly when you need them
Further the documentation by default recommends that you replace the xfbml tags immediately with facebook like buttons as soon as the page is loaded. Therefore it has
xfbml : true // parse XFBML
as option to almost all mentions of calling FB.init. You don't want that.
If you have so many like buttons it is quite likely that you don't need to load all of them initially. The JavaScript SDK offers a function for parsing and replacing the fbxml explicitly. You can call it on a certain DOM node instead of the whole page. See FB.XFBML.parse. This way you can load the buttons when you need them, you could even lazily only load those that are currently visible in the browser similar to image lazy loading techniques.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With