2

単一ページのバックボーン アプリケーションのログイン ページで、Twitter に埋め込まれたタイムライン ウィジェットを使用しています。ユーザーがログインすると、バックボーン ルーティングを介してページを変更すると、Twitter ウィジェットが表示されなくなります。ただし、ブラウザー開発者ツールの [ネットワーク] パネルを見ると、http://syndication.twimg.com/widgets/timelines/paged/ ... への要求が 15 秒ごとに表示されます。これらのリクエストを停止するにはどうすればよいですか?

Idelete window.twittrの場合、タイムアウト コールバックから 6 つの「Uncaught ReferenceError: twttr is not defined」エラーが発生します...これは機能しますが、あまりクリーンではないようです。より良い方法はありますか?

4

1 に答える 1

1

a を設定するTweet limitことはオプションになると思います。

ツイート制限: To fix the size of a timeline to a preset number of Tweets, use the data-tweet-limit="5" 属性 with any value between 1 and 20 Tweets. The timeline will render the specified number of Tweets from the timeline, expanding the height of the widget to display all Tweets without scrolling. ウィジェットは固定サイズであるため、このオプションを使用すると更新をポーリングしません。

https://dev.twitter.com/docs/embedded-timelines

例えば

<a class="twitter-timeline" href="https://twitter.com/twitterapi" data-widget-id="YOUR-WIDGET-ID-HERE" data-chrome="nofooter" data-tweet-limit="3">Tweets by @twitterapi</a>

そして、必要に応じて、ウィジェットを削除して html を再挿入してから呼び出すことにより、ウィジェットを手動で更新できます。

twttr.widgets.load()

于 2013-11-07T18:39:28.500 に答える