使用Javascript从浏览器屏幕截图? [英] Screencapture from the browser using Javascript?

查看:90
本文介绍了使用Javascript从浏览器屏幕截图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想这是一个奇怪的问题,答案很可能是不可能的,因为它代表了安全漏洞;但我正在寻找一种方法 - 如果有的话 - 在浏览器中获得一个内容的screendump。我不需要整个窗口,但实际上只需要转储标记的呈现状态。它需要跨平台和跨浏览器兼容。

I guess this is an odd one, and the answer is most likely it is not possible since it would represent a security breach; but I am looking for a way - if any - to get a screendump of content inside the browser. I don't need the entire window, but actually just need to dump the rendered state of an tag. It need to be cross platform and cross browser compatible.

推荐答案

在纯JavaScript中无法完成它。

It cannot be done (yet) in pure JavaScript.

作为旁注,如果您的目标是进行渲染测试,您可以尝试在托管环境中实例化目标浏览器(即在WinForms应用程序中托管Internet Explorer并获取渲染内容的屏幕截图) - 这将显示Silverlight插件并允许截取屏幕截图。

As a side-note, if your goal is to make rendering tests, you could try instantiating the target browsers within a hosted environment (i.e. host Internet Explorer in a WinForms application and get a screenshot of the rendered content) - this will show the Silverlight plug-in and allow taking screenshots.

这篇关于使用Javascript从浏览器屏幕截图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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