Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you take a "screenshot" of the page using Canvas?

I have a page where we're positioning a bunch of elements using CSS, and changing their "top and left" positions using JS.

I've had reports that these things have been misaligned, but a user has the motive to lie about this to "cheat", so I'm not exactly sure whether they're telling the truth. I'm trying to find a way to figure out whether they're lying or not, and to have some "proof".

I know that Canvas has a method to copy image information from an image element, or another canvas element (kind of a BitBlt operation).

Would it be possible to somehow, with Canvas (or with something else, Flash, whatever), take a "picture" of a piece of the page?
Again, I'm not trying to take information from an <image>. I'm trying to copy what the user sees, which is comprised of several HTML elements positioned absolutely (and I care most about those positions) and somehow upload that to the server.

I understand this can't be done, but maybe I'm missing something.

Any ideas?

like image 254
Daniel Magliola Avatar asked Dec 02 '10 21:12

Daniel Magliola


People also ask

Can the canvas app detect screenshots?

Go to Solution. As far as I know, no, it doesn't record if a student took a screen shot or not. The best way to confirm this is to contact Canvas Support and see what they have to say. You can do this by going to the quiz log in question and then clicking on the Help link (bottom left) and Report a Problem.

How do I capture a canvas image?

If you wish to make the user download the file as it is saved you can do the following: var canvas = document. getElementById("mycanvas"); var image = canvas. toDataURL("image/png").

Is there a way to take a screenshot of an entire webpage?

Also, you can press Ctrl+Shift+P on Windows or Command+Shift+P on Mac. Type screenshot into the search box. Select Capture full-size screenshot. Once Chrome takes the screenshot, it should save it into your Downloads folder.


2 Answers

Somebody asked a question earlier that's somewhat similar to this. Scroll to the bottom of Youtube and click the "Report a Bug" link. Google's Feedback Tool (Javascript driven), essentially does what you described. Judging by what I looked at of its code, it uses canvas and has a JavaScript-based JPEG encoder which builds a JPG image to send off to Google.

It would definitely be a lot of work, but I'm sure you could accomplish something similar.

like image 191
simshaun Avatar answered Oct 18 '22 14:10

simshaun


If a commercial solution is an option, Check out SnapEngage. Click on the "help" button in top-right to see it in action. Here is a screenshot:-

enter image description here

Setup is pretty straight-forward you just have to copy and paste a few lines of javascript code.

SnapEngage uses a Java Applet to take screenshots, Here is a blog post about how it works.

like image 34
Salman von Abbas Avatar answered Oct 18 '22 14:10

Salman von Abbas