How to consistently and reliably show Tweet buttons?


Hi all!

I’m having a lot of issues using widgets.js.

I have a standard button: [a href=“” class=“twitter-share-button”]Tweet[/a]

I have tried loading widgets.js at the top of the page. I’ve tried at the bottom. I’ve tried including the script right after I create the link.

The problem is consistency. widgets.js seems to only sometimes process the link and turn it into a Tweet button. The Tweet button can show fine sometimes, then be unprocessed after a refresh.

I have tried the following:

[script] in the heading.

[script] in the footer.

[script] just after the [a] to be processed.

I’ve also tried downloading widgets.js and including the entire code within my page, thus guaranteeing that twttr will be available, but even still, it is not, and the link goes unprocessed.

I’ve also tried using $(func) to wait for the document to load. In that func, I use twttr.ready(func) to make sure twttr is ready before I bind to the tweet event.

One thing always works: after the page is loaded I open my console and use twttr.widgets.load() and it will process the link. Other than manually doing that, nothing else works consistently. Any input would be greatly appreciated.

Thanks in advance :slight_smile: