html5 - 网页截图是怎么实现的?
PHP中文网
PHP中文网 2017-04-17 11:03:02
0
4
572

Using HTML5/Canvas/Javascript to take screenshots?
还是通过浏览器api呢?
THX....

PHP中文网
PHP中文网

认证0级讲师

reply all(4)
PHPzhong
  1. Page scripts cannot achieve the permission to take system screenshots;
  2. Unless the browser itself provides an API, the browser itself is a client on the local system (local clients generally have the permission to capture screens);
  3. However, the browser's screenshot API has limited permissions, that is, it can only capture pictures of the current browser window, but not pictures outside the browser. Example: Huaban.com's chrome browser plug-in;
  4. I have noticed that the screenshot function of web qq and the web version of WeChat requires that a client (usually called a browser "plug-in") be installed locally to be able to take screenshots.
刘奇

I just happened to be developing a chrome plug-in recently. Chrome has an API called captureVisibleTab, which can capture tabs into images in any format supported by webkit. I'm not sure about the rest, haha.

chrome.tabs.captureVisibleTab(integer windowId, object options, function callback)

https://developer.chrome.com/extensio...

PHPzhong

You can try html2canvas

It renders the current page into a canvas image. The specific method is to read the DOM elements and their styles and then render them into the canvas. No server rendering is required, the entire process is completed on the browser side.

刘奇

Your name is Jing Wentian?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template