javascript - Good JS lib to take screenshot of the screen - Stack Overflow

I want my users to be able to take a screenshot of the webpage (or me defining the size of the screensh

I want my users to be able to take a screenshot of the webpage (or me defining the size of the screenshot) and then allowing them to save it to their puter.

Does anyone know of a good JS lib that allows you to do this?

I know there are addons for the browser, but i wanted something pure JS so that the user can just click in a button and a "save as" link apears with a screenshot of what they are looking at.

Thanks for the help.

/fmsf

I want my users to be able to take a screenshot of the webpage (or me defining the size of the screenshot) and then allowing them to save it to their puter.

Does anyone know of a good JS lib that allows you to do this?

I know there are addons for the browser, but i wanted something pure JS so that the user can just click in a button and a "save as" link apears with a screenshot of what they are looking at.

Thanks for the help.

/fmsf

Share Improve this question edited May 14, 2010 at 13:05 fmsf asked May 14, 2010 at 11:53 fmsffmsf 37.2k49 gold badges153 silver badges196 bronze badges 2
  • 2 Not possible, there is no cross-browser solution to create screenshots with pure javascript (assuming there's a pure javascript solution for any browser). – Wolph Commented May 14, 2010 at 11:56
  • Does this answer your question? Using HTML5/Canvas/JavaScript to take in-browser screenshots – Anderson Green Commented Jan 8, 2022 at 12:03
Add a ment  | 

3 Answers 3

Reset to default 4

Browsers don't expose APIs that allow this to web pages, so there is no way to achieve this using plain JavaScript running in a page.

The only way to achieve this would be to have screen grabs prepared on the server, and a normal download link pointing to the appropriate one.

This can't be done in JavaScript. Taking screen shots outside the current document/domain is a potential security problem and is not possible. See my question about getting the pixel colour from the current mouse position for more background.

If you need to transmit the screen shots onto your server, look into external applications that interact with your web site. Open-source bug tracker Mantis for example has a screenshot application for Windows.

If the screenshot and the saving of the file are both to take place on the client puter, check out Fireshot for Firefox. It doesn't seem to offer any interaction capabilities with a pre-defined web site but may be the right tool for your users.

HTML2Canvas (http://html2canvas.hertzen./) recreates the rendered HTML into a canvas. And you can save the canvas as an image. That could do the trick, although it's not 100% accurate (and for good reasons - that would open security holes in browsers if that was possible, see https://stackoverflow./a/1936084/1333479).

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745202300a4616398.html

相关推荐

  • javascript - Good JS lib to take screenshot of the screen - Stack Overflow

    I want my users to be able to take a screenshot of the webpage (or me defining the size of the screensh

    7小时前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信