当 Rails 向 Chrome 或 Safari 提供图像时,图像会闪烁
在执行一些跨浏览器测试时,我注意到刷新页面时我的图像会闪烁 - 但仅适用于 Chrome/Safari - 而不是 Firefox 或 IE。显示白色区域,然后显示图像。
我有一些由设计师提供的相同标记,但没有显示这个问题。最后,我将范围缩小到 Rails 本身。当 Rails 提供页面时,它会闪烁(在 Chrome/Safari 中)。当相同的标记刚刚从本地文件系统在浏览器中打开时,它不会闪烁。
最终,我决定看看其他 Rails 站点是否有这个问题 - 他们确实有! basecamphq.com 在 Chrome 中刷新时会闪烁,但在 Firefox 中则不会(或者至少少得多)。
这是 WebKit 的已知问题吗?这个问题有解决方案或解决方法吗?
In performing some cross-browser testing, I noticed that my images flicker when the page is refreshed - but just with Chrome/Safari - not with Firefox or IE. A white area is displayed, then the image is displayed.
I had some identical markup provided by the designer that didn't show this problem. Finally, I narrowed it down to Rails itself. When Rails serves the page, it flickers (in Chrome/Safari). When the same markup is just opened in the browser from the local file system, it doesn't flicker.
Eventually, I decided to see if other Rails sites had this problem - and they do! basecamphq.com flickers on refresh with Chrome, but doesn't (or at least, it does much less) with Firefox.
Is this a known problem with WebKit? Is there a solution or workaround to this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我的经验是,通过 html 宽度/高度属性调整大小的大图像在某些浏览器中往往会闪烁。解决方案 - 在提供之前通过 ImageMagick 或类似工具调整图像大小
My experience is that large images that are resized via the html width/height attribute tend to flicker in certain browsers. The solution - have the image resized via ImageMagick or similar before serving