Although the two versions are very similar to one another in their basic function, it does make a difference whether you opt for a Facebook button in the form of an iFrame or a JavaScript application in your web project. Since both social plugins are hosted by Facebook, the social network automatically knows whether the user is logged in – and if they are, it will display a personalized form of the button. In the case of the iFrame, this personalization comes in the form of a list of all of the site visitor’s friends who have previously liked this website or post (including their profile pictures). If the site visitor isn’t logged in or even doesn’t operate a Facebook account, then an invitation or prompt to log in or register will automatically appear.
The JavaScript plugin has an additional benefit – it allows users to add a comment when they click on the like button. Unlike the iFrame, which is a single HTML element, the JavaScript version also requires you to embed the Facebook SDK as well as the button code line. You can also use this powerful developer kit to integrate a login feature to the social network.
In order for Facebook to display these personalized buttons, the user’s browser contacts the Facebook servers automatically. If the user is logged into the social network, or has been logged in previously, and calls up a page that has a social plugin, then the user can be identified precisely. But this does mean that in return, Facebook receives information such as the access time, user ID, or even information about the browser being used and the individual IP address. The social media giant has previously expressed that it reserves the right to store and use this collected data in order to improve its own products and services as well as to optimize targeted ad displays. This has led to some countries, including Germany, declaring this traditional approach to include the Facebook like button and other social plugins to be unlawful.