Skip to content

Commit 3329810

Browse files
committed
moved loading to body
1 parent 5b4de80 commit 3329810

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/Facebook.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,21 +60,17 @@ export default class Facebook {
6060
resolve(window.FB);
6161
};
6262

63-
const fjs = window.document.getElementsByTagName('script')[0];
64-
if (!fjs) {
65-
return;
66-
}
67-
6863
if (window.document.getElementById('facebook-jssdk')) {
6964
return;
7065
}
7166

7267
const js = window.document.createElement('script');
7368
js.id = 'facebook-jssdk';
7469
js.async = true;
70+
js.defer = true;
7571
js.src = `https://${domain}/${language}/sdk${debug ? '/debug' : ''}.js`;
7672

77-
fjs.parentNode.insertBefore(js, fjs);
73+
window.document.body.appendChild(js);
7874
});
7975

8076
return this.loadingPromise;

0 commit comments

Comments
 (0)