Twitter 按钮和 Google Page Speed
在包含 Twitter 推文按钮的页面上,我收到来自 Google Page Speed 的警告:
以下资源具有相同的内容,但通过不同的 URL 提供。从一致的 URL 提供这些资源可节省 3 个请求和 52.0KiB。 http://platform0.twitter.com/widgets/tweet_button.html http://platform1.twitter.com/widgets/tweet_button.html http://platform2.twitter.com/widgets/tweet_button.html
以下资源具有相同的内容,但通过不同的 URL 提供。从一致的 URL 提供这些资源可节省 2 个请求和 4.6KiB。 http://platform0.twitter.com/widgets/images/tweet.png http://platform1.twitter.com/widgets/images/tweet.png http://platform2.twitter.com/widgets/images/tweet.png
为什么 Twitter 的 widgets.js 为每个组件提供不同的 URL,有什么办法可以解决这个问题吗?
On a page that has Twitter's Tweet buttons, I get warnings from Google Page Speed:
The following resources have identical contents, but are served from different URLs. Serve these resources from a consistent URL to save 3 request(s) and 52.0KiB.
http://platform0.twitter.com/widgets/tweet_button.html
http://platform1.twitter.com/widgets/tweet_button.html
http://platform2.twitter.com/widgets/tweet_button.htmlThe following resources have identical contents, but are served from different URLs. Serve these resources from a consistent URL to save 2 request(s) and 4.6KiB.
http://platform0.twitter.com/widgets/images/tweet.png
http://platform1.twitter.com/widgets/images/tweet.png
http://platform2.twitter.com/widgets/images/tweet.png
Why does Twitter's widgets.js serve up different URLs for each of these and is there any way around it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
它可能从不同的 URL 为它们提供服务,以平衡请求的负载;然而,正如页面速度正确指出的那样,在单个请求的上下文中这实际上是一个坏主意(尽管为不同的请求轮换域是有意义的),因为它会导致资源的缓存未命中。
It probably serves them from different URLs to load-balance the requests; however, as page speed correctly points out, this is actually a bad idea to do within the context of a single request (though it makes sense to rotate the domains for distinct requests), since it results in a cache miss of the resource.
以下是 Twitter 工程师在 Twitter 网站论坛上的回答: https://dev.twitter.com /讨论/8671
Here is the answer on the twitter for websites forum, by a Twitter engineer: https://dev.twitter.com/discussions/8671