Currently, the FB.Share script tag is added to each and every instance of the facebookshare_button output. This is unnecessary and possibly harmful. The script is written in such a way as to be loaded once. It iterates through all of the fb_share objects and does its work to all of them at once.
The attached patch updates the module so that it loads the FB.Share script only once at the end of the page. It also makes the script tag themeable output so sites like ours can lazy-load the script.
| Comment | File | Size | Author |
|---|---|---|---|
| facebookshare_script.patch | 1.31 KB | mgriego |
Comments
Comment #1
aaronsnoswell commentedI can confirm that this is happening, and that on my site it is breaking the FB share module. (It will display on some nodes, but not on others) - an error is logged to the console:
Your patch file didn't work for me - the third hunk couldn't be applied. Going to try and fix it manually.
Comment #2
raulmuroc commentedAs not moving: the same in 7.x.
Comment #3
szt commentedSee #1937592: FB.Share script called in multiple times unnecessarily