Facebook likebox, which code is better

I put the LikeBox facebook plugin on the webpage I'm working on. It is built on HTML and CSS and JavaScript.

I wanted to know which code is best to use, since there are three options ... for example, in less load time. HTML5 or XFBML or IFRAME? I would really appreciate if anyone could, please tell me your suggestions. thanks.

+6
source share
2 answers

They use JavaScript to parse XFBML / HTML5 and convert them to iframes.
Therefore, if you just show plugins, any of them work, but HTML5 and XFBML give you more options.
For example, the iframe version of Like Button does not provide you with the ability to display the submit button, but HTML5 and XFBML do.
And the HTML5 / XFBML versions give you the ability to set callback functions.

So, if you need or want to customize, HTML5 and XFBML are better.
Using HTML5 or XFBML is entirely up to you.
When you encode your site in HTML5 and want your markup to be legal, the HTML5 version will be nice.

+5
source

If you are using HTML5 or XFBML, you need to download the JavaScript SDK on YouTube to calculate the loading time of your pages, since the external script resource is directly embedded in your code. (Although it usually loads asynchronously, it doesn’t slow down the rest of the page, nor does it delay the load event.)

The iframe version, on the other hand, loads "on its own." Only iframe element code is on your page, and loading its actual content is seen as loading a completely unrelated page by the browser. ever a lot of time to load an iframe document (in case Facebook is “down” or temporarily temporarily), it will not affect your own page and its loading event in any way.

Despite these facts, Id usually comes with either HTML5 or XFBML — not so much based on the factors described, but because I feel that I have more “control” over them (for example, without activating them immediately, but perhaps they figured out only after some user interaction with the page or so).

+8
source

Source: https://habr.com/ru/post/917938/


All Articles