Dynamically loading embedded Twitter timeline
Twitter has great built-in timelines, however I can only get it to work by copying the twitter widget code:
<a class="twitter-timeline" data-widget-id="SOME_WIDGET_ID">Tweets about XXXXX</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>
Is there a way to dynamically load an inline timeline in a div based on the widget id?
+3
source to share
2 answers
There is: https://plus.google.com/u/0/110804953626559077511/posts/j65ntqa5Qd3
I do not recommend doing this. All Twitter has to do is change one tiny thing in the widgets.js file and it will stop working.
0
source to share
If you have a file widgets.js
, you can use twttr.widgets.createTimeline()
to specify an item to create a timeline. Just set the username dynamically and it should work.
0
source to share