繁体   English   中英

如何阻止Twitter时间轴小部件轮询?

[英]How to stop Twitter Timeline Widget from Polling?

我将登录页面上的Twitter嵌入式时间轴小部件用于单页Backbone应用程序。 当用户登录时,我通过骨干网路由更改了页面,并且不再显示Twitter小部件。 但是,如果您查看浏览器开发人员工具的“网络”面板,则会每隔15秒左右请求一次http://syndication.twimg.com/widgets/timelines/paged/ ...。 如何停止这些请求?

如果delete window.twittr ,则会从超时回调中收到6个“ Uncaught ReferenceError:未定义twttr”错误……可以,但是看起来不是很干净。 有没有更好的办法?

我认为可以设置Tweet limit

Tweet限制: 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. 属性的 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. 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()

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM