diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/assets/embed.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main/assets/embed.js b/src/main/assets/embed.js index 6cb02110..6498971c 100644 --- a/src/main/assets/embed.js +++ b/src/main/assets/embed.js @@ -254,14 +254,15 @@ function getEmbeddableLinkTypes() { div.innerHTML = `<blockquote class="twitter-tweet" data-lang="en"><a href="${url}"></a></blockquote>`; if (window.twttr) { + // this will only happen if you embed another set of twitter posts after the twitter script loads (likely never) // https://developer.twitter.com/en/docs/twitter-for-websites/javascript-api/guides/scripting-loading-and-initialization window.twttr.widgets.load(div); - } else { + } else if (!document.head.querySelector ('[src="https://platform.twitter.com/widgets.js\"]')) { // innerHTML cannot insert scripts, so... let script = document.createElement('script'); script.src = 'https://platform.twitter.com/widgets.js'; script.charset = 'utf-8'; - div.appendChild(script); + document.head.appendChild(script); } return div; |