1

As we know Twitter.com was down in yesterday(2012/07/26) some period of time. In that time my website home page somewhat unresponsive. The homepage was trying to load the twitter feed and failing, and thus other page elements in my site appears broken, like a jquery slider has trouble loading correctly, because its trying to load the twitter API.

Hove to fix this to homepage ignore twitter feed if the site notices that it is down, and displaying a short error notice in place of the feed?

I am using following customize twitter widget (got from here) to show latest 2 twitts in Home page.

<div id='twitter_div'>                        
<ul id='twitter_update_list'>       
</ul>                             
</div>
<script type='text/javascript' src='http://twitter.com/javascripts/blogger.js'></script>

<script type='text/javascript'>
// to filter @replies in twitter feed
    function filterCallback( twitter_json )
        { var result = [];for(var index in twitter_json) 
        { if(twitter_json[index].in_reply_to_user_id == null) {result[result.length] = twitter_json[index]; }
        if( result.length==2 ) break;}twitterCallback2(result); }
    </script>

<script type='text/javascript' src='http://twitter.com/statuses/user_timeline/DUOBoots.json?callback=filterCallback&amp;count=10'></script>
4

1 に答える 1

1

Twitter フィードの読み込みを遅らせる必要があります。ページの残りの部分はすぐに読み込まれ、Twitter がダウンしても、ページの残りの部分はブロックされません。とにかくこれを行うことは良い習慣です。

jquery を使用してこれを行う例については、https: //dev.twitter.com/discussions/3369 を参照してください。

于 2012-07-27T05:38:59.043 に答える