How to take screenshot of a div with JavaScript?

前端 未结 10 1694
误落风尘
误落风尘 2020-11-22 08:03

I am building something called the \"HTML Quiz\". It\'s completely ran on JavaScript and it\'s pretty cool.

At the end, a results box pops up that says \"Your Result

10条回答
  •  一整个雨季
    2020-11-22 08:21

    You can't take a screen-shot: it would be an irresponsible security risk to let you do so. However, you can:

    • Do things server-side and generate an image
    • Draw something similar to a Canvas and render that to an image (in a browser that supports it)
    • Use some other drawing library to draw directly to the image (slow, but would work on any browser)

提交回复
热议问题