使用HTML5 Canvas捕获网页的一部分? [英] Use HTML5 Canvas to capture part of a web page?

查看:263
本文介绍了使用HTML5 Canvas捕获网页的一部分?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道您可以使用画布从HTML5视频流捕获图像,并在页面上显示它们。我感兴趣的是你可以使用canvas对象在网页顶部创建一个覆盖,然后捕获该页面或其一部分的PNG快照。

I know that you can capture images from an HTML5 video stream using canvas and display them on the page. What I am interested in is can you use the canvas object to create an overlay on top of a web page and then capture a PNG snapshot of that page or part of it.

我想通过添加屏幕捕获(在浏览器页面中)来增强我们的网站审查工具,然后可以将其提交到远程服务器。

I would like to enhance our website reviewing tools by adding screen capture (within the browser page) which could then be submitted to a remote server.

YouTrack使用Java applet执行此操作,但是可以使用现代HTML5技术吗?

YouTrack does this with a Java applet but is it possible with modern HTML5 techniques?

感谢

推荐答案

被问到很多。

更长的答案包括提及 drawWindow 只有FireFox具有的功能,它只在本地工作(出于安全原因,再次)。在将来,一旦用户给予许可,它可能工作,就像今天的Java applet的情况一样。在未来,它甚至可能是规范的一部分,而不是Mozilla做的一次性事情。

The longer answers include mention of the drawWindow function that only FireFox has, which only works locally (again, for security reasons). In the future it may work once the user gives permission, like in the case of the Java applets of today. In the future, it might even be part of the spec and not a one-off thing done by Mozilla.

如果你感到疯狂,你可以尝试做一个完整的HTML渲染器,获取页面的DOM树,并尝试在Canvas中渲染它。这是一个傻瓜的错误。

If you're feeling crazy, you could attempt to make an entire HTML renderer, take the DOM tree for the page, and attempt to render it in Canvas. This is a fool's errand.

这篇关于使用HTML5 Canvas捕获网页的一部分?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆