Note that there are some explanatory texts on larger screens.

plurals
  1. POEmbed Twitter User Timeline in Webpage
    text
    copied!<p>On my website, a user enters their Twitter username when they register and their timeline is embedded on their profile page. Until now, I've achieved this with the following JavaScript code:</p> <pre><code>&lt;script type="text/javascript"&gt; var twitterUsername = // read from database new TWTR.Widget({ version: 2, type: 'profile', rpp: 4, interval: 30000, width: 'auto', height: 210, features: { scrollbar: true, loop: false, live: false, behavior: 'all' } }).render().setUser(twitterUsername).start(); &lt;/script&gt; </code></pre> <p>Recently I noticed the following messages appearing in the JavaScript console</p> <blockquote> <p>TWITTER WIDGET: This widget is being deprecated, and will cease functioning soon. <a href="https://twitter.com/support/status/307211042121973760" rel="nofollow">https://twitter.com/support/status/307211042121973760</a></p> <p>TWITTER WIDGET: You can obtain a new, upgraded widget from <a href="https://twitter.com/settings/widgets/new/user?screen_name=electricpicnic" rel="nofollow">https://twitter.com/settings/widgets/new/user?screen_name=electricpicnic</a></p> </blockquote> <p>It seems that instead of using this widget I should use an embedded timeline. However, the docs seem to suggest that in order to embed a timeline in a page, you need to go to the <a href="https://twitter.com/settings/widgets" rel="nofollow">widgets section of your settings page</a> and setup a widget for <em>each user</em> whose timeline you wish to embed. Twitter gives you the code that will embed this timeline in your page, but this code contains an attribute <code>data-widget-id="275025608696795138"</code> which has a different value for each user.</p> <p>Obviously this approach won't work for me, because it's not feasible for me to setup a widget for all my users (present and future) and store a <code>data-widget-id</code> for each of them. Is there some non-deprecated way that I can embed timelines, which allows me to provide the Twitter username at runtime?</p> <h2>Update</h2> <p>According to <a href="https://dev.twitter.com/discussions/17774" rel="nofollow">this post</a> in the Twitter dev discussion group, this functionality is not available currently, but will be provided in a future version.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload