无法在
我正在使用 元素编写一个 Web 应用程序。为了简单起见,我将其精简为显示问题所需的基本要素:http://demo.kuehldesign。 net/imagetest/
在 Safari 和 Chrome (Mac) 上,绘制在画布上的 test.png
图像始终会显示,即使之前未下载过也是如此。
由于某种原因,当 Firefox 之前没有下载过该文件(并且可能将其存储在缓存中)时,该文件不会显示(即使 Image.onload
被调用)。
复制:
- 在最新的 Firefox 中打开上面的链接(我使用的是 Mac,猜测其他操作系统上也会发生这种情况)
- 刷新页面。那个时候应该就可以了。
- 刷新页面时按住 Shift 键不使用缓存。您应该看到下载图像时调用的状态,但看不到图像。
相同的步骤可以在 Chrome 和 Safari 中很好地显示图像。
有什么想法为什么 Firefox 即使在加载后也不显示图像吗?理想情况下,我想继续将 Image
对象作为参数传递给 test
函数。
谢谢。
I'm writing a web application using a <canvas>
element. For simplicity, I have stripped it down to the bare essentials needed to show the problem: http://demo.kuehldesign.net/imagetest/
On Safari and Chrome (Mac), the test.png
image which is drawn on the canvas always shows, even when it was not previously downloaded.
For some reason, when Firefox has not previously downloaded the file (and presumably stored it in the cache), the file is not displayed (even though Image.onload
is called).
To replicate:
- Open the link above in the latest Firefox (I'm on Mac, guessing it happens on other OSes as well)
- Refresh the page. It should have worked that time.
- Hold shift while refreshing the page to not use the cache. You should see a status which is called when the image is downloaded, but not see the image.
The same steps show the image fine in Chrome and Safari.
Any ideas why Firefox is not showing the image even after it has loaded? Ideally I would like to continue passing the Image
object as a parameter to the test
function.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我可以在 Firefox 中看到图像,它似乎对我来说工作正常。
I can see image in Firefox, it seems working fine for me.
添加
onload
事件处理程序后设置image.src = image.src
修复了该问题。Setting
image.src = image.src
after adding theonload
event handler fixed the problem.