您可以选择“屏幕截图”的页面使用Canvas? [英] Can you take a "screenshot" of the page using Canvas?

查看:160
本文介绍了您可以选择“屏幕截图”的页面使用Canvas?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个页面,其中我们使用CSS定位一堆元素,并使用JS更改它们的顶部和左侧位置。



报告这些东西已经失调,但用户有动机谎言这是欺骗,所以我不能确定他们是否说实话。我试图找出一个方法来弄清楚他们是否撒谎,并有一些证据。



我知道Canvas有一个方法从一个图像元素或另一个canvas元素(一种BitBlt操作)复制图像信息。



可能以某种方式,使用Canvas Flash,无论什么),拍一张页面的图片?

同样,我不是试图从< image>获取信息。我试图复制用户看到的内容,它由几个HTML元素组成,绝对定位(我主要关心这些位置),并以某种方式将其上传到服务器。



任何想法?

解决方案

有人问过一个问题,有点类似于这个。滚动到Youtube底部,然后点击报告错误链接。 Google的反馈工具(基于Javascript驱动)基本上是你所描述的。根据我看到的代码,它使用画布,并有一个基于JavaScript的JPEG编码器,构建一个JPG图像发送给Google。



是很多工作,但我相信你可以完成类似的事情。


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 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 mostly 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?

解决方案

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.

这篇关于您可以选择“屏幕截图”的页面使用Canvas?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆