使用Firefox中的只有js的屏幕截图

问题描述:

我正在考虑构建一个Firefox扩展。 此扩展需要执行屏幕截图的功能。 是否有可能这样做只使用JavaScript?使用Firefox中的只有js的屏幕截图

+2

如果我是一个年轻人,性情急躁,大胆,无畏,我会铤而走险,并提供一个真正的答案简单地阅读,“不” – Pointy 2011-01-20 00:13:10

更新:除非您正在编写插件,否则此功能已从Firefox中删除。敬请期待不同的选择,看看http://badassjs.com/post/12473322192/hack-of-the-day-rendering-html-to-a-canvashttps://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/drawWindow

早在天,你可以:采取Firefox的窗口的屏幕截图,是的,它是如此容易疼。您必须将其渲染为画布。见https://developer.mozilla.org/en/drawing_graphics_with_canvas#Rendering_Web_Content_Into_A_Canvas

<canvas id='my-canvas'></canvas> 
<script> 
var canvas = document.getElementById('my-canvas'); 
var ctx = canvas.getContext("2d"); 
// Draw the window at the top left of canvas, width=100, height=200, white background 
// drawWindow has been removed :(
ctx.drawWindow(window, 0,0, 100, 200, "rgb(255,255,255)"); 
// Open another window with the thumbnail as an image 
open(canvas.toDataURL("image/png")); 
</script> 

如果你指的是整个桌面的截图,我不这么认为

+0

你是一个拯救生命的人。谢谢:) – vondip 2011-01-20 07:02:14