Search code examples
javascripthtmltwitterfeed

Displaying Twitter feed stopped working


The default way to display a twitter feed has stopped working. Here is an example code:

<html>
    <head>
        <script type="text/javascript" src="http://twitter.com/javascripts/blogger.js"></script>
    </head>
    <body>
        The feed should display below:
        <div id="twitter_update_list"> </div>
        <script type="text/javascript" src="http://twitter.com/statuses/user_timeline/stackoverflow.json?callback=twitterCallback2&amp;count=4">
    </body>
</html>

Why is this not working? I suspected that the issue was on Twitter's end but this has not functioned for a while now. I created a fiddle in case you want to play: http://jsfiddle.net/9EvXn/


Solution

  • You need to update your code to Twitter's new API. This code will work:

    <html>
        <head>
            <script type="text/javascript" src="http://twitter.com/javascripts/blogger.js"></script>
        </head>
        <body>
     <div id="twitter_update_list"></div>
                <script type="text/javascript" src="http://api.twitter.com/1/statuses/user_timeline.json?screen_name=stackoverflow&include_rts=true&count=4&callback=twitterCallback2"></script>
    </div>
        </body>
    </html>
    

    Pay attention to this line of code that is updated:

    http://api.twitter.com/1/statuses/user_timeline.json?screen_name=stackoverflow&include_rts=true&count=4&callback=twitterCallback2