3

我一直在处理 Firefox 和 Safari 浏览器的屏幕截图,但我不知道该怎么做!使用 Google Chrome API,我可以这样做(非常简单):

chrome.tabs.captureVisibleTab(null, null, function (image)).....etc

但我在 Firefox 和 Safari 上找不到简单的方法!我在这里得到的唯一答案是使用“html2canvas”(http://html2canvas.hertzen.com/examples.html),但它不是一个 100% 的解决方案,以便对特定网页进行精确截图!!在这种情况下它对我不起作用!!!有人可以帮我解决这个问题,以便为 Firefox 和 Safari 找到一个简单的解决方案吗?

4

2 回答 2

1

You can use Mozilla's chrome tools to draw some or all of the window to an image canvas:

var c2d = myCanvas.getContext('2d');
c2d.drawWindow(window, x, y, w, h, 'rgb(255,255,255)');

See drawWindow(), XUL.

I don't remember exactly, but that's the gist. The magic is the .drawWindow() method, which cannot be executed on the content side, it must be in an area with chrome privileges (like an add-on/extension).

Edit: Here's a good example.

于 2014-01-03T04:30:15.290 回答
1

I have personally used html2canvas and I found it quite efficient for taking partial or full page screenshots. But it does require you some knowledge of JavaScript and client side scripting.

If you are looking for a more easier approach , there are numerous extensions on Google Chrome webstore. A popular one is Awesome Screenshot which even allows you to take screenshot of entire webpage (till the scroll bar ends).

于 2013-05-13T16:29:49.153 回答