I've been doing a lot of research into Twitter's Embedded Timelines. I've been trying to figure out if it is possible to know when the timeline is finished loading and displays on the page. This issue has been requested, but has yet to be implemented. I have come to a dead end an am hoping someone is able to help me find the solution. Here is what I have found so far:
The code to add an Embedded Timeline:
<a class="twitter-timeline" href="https://twitter.com/twitterapi" data-widget-id="YOUR- WIDGET-ID-HERE">Tweets by @twitterapi</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
What happens when the script is run:
The script replaces the
<a>tag with an<iframe>element.The contents of the
iframeare ready, but the avatar image and the 'follow @username' button are not done downloading. Theiframe'sheightattribute is set to 0 so that you don't see the content without the images.The avatar image is downloaded, but the 'follow @username' button is still downloading. Content is still not visible.
The 'follow @username' button is finished downloading. The
iframe'sheightattribute is set to match the height of the contents of theiframe. The timeline is now visible.
Now, I've tried everything I can think of to figure out when the timeline is visible (without using settimeout/interval). The goal is to have a non-polling event/function/callback. Here is what I have tried so far without success:
- Setti