JavaScript 有没有办法截取 silverlight 元素的屏幕截图?
基本规则:
- 无 flash
- 无附加组件
- 至少必须在 IE8 上支持
我想知道 Canvas 是否可以与 JS 结合使用,并且可能是一些巧妙的 JS 库。
更新 - 我需要截取该 silverlight 元素的屏幕截图,但未提供其来源。 (我的人生故事)在决定完全重新创建银光元素之前,我想我应该尝试一下。
更新 2 - 用另一个 .xap 包装 silverlight 的 .xap 怎么样? (就像flash可以在另一个swf文件中播放swf文件一样)我不确定这是否可能,因为我是silverlight的新手。
更新3 - 由于我不再尝试解决这个问题,所以我无法尝试好家伙们给出的解决方案。我将在大约两周后选择一个得票数最高的答案。
Ground rules:
- No flash
- No add-ons
- Must be supported on IE8 at the least
I'm wondering if Canvas could do it in combination with JS and may be some ingenious JS libraries.
Update - I am required to take a screenshot of that silverlight element, without being provided with it's source. (Story of my life) Before resolving to totally recreating the silverlight element, I thought I would give it a shot.
Update 2 - How about wrapping the silverlight's .xap with another .xap? (like flash could play a swf file inside another swf) I'm not sure if that's possible, being new to silverlight.
Update 3 - Since I am no longer trying to work on this problem, I'm not in a position to try the solutions given by the goodfellas. I'll be choosing an answer with the highest number of votes in about 2 weeks from now.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不,允许截取屏幕截图可能会导致安全问题,例如,如果有人在您查看在线银行网站时注入 JavaScript 并截取屏幕截图。
话虽如此,silverlight 论坛< 上似乎有关于使用 SilverLight 执行此操作的讨论< /a>.可能是你想要的。
No, allowing screenshots to be taken could cause security issues e.g. if someone injected javascript and took screenshots when you were looking at your online banking site.
Having said that there seems to be a discussion about doing this with SilverLight on the silverlight forum. Could be what you want.
是的,这是可能的...
在 C# 代码中使用以下代码
:
例如。 swf 文件网址: http://xyz.net/evideos/tanzanite-01/7398a.swf 或者您也可以设置本地路径。
VodeoUrl = 视频[0].ToString();
yes it's possible...
use below code
in C# code :
eg. swf file url: http://xyz.net/evideos/tanzanite-01/7398a.swf or you can set local path also.
VodeoUrl = video[0].ToString();
Javascript 与浏览器交互的 API 被设计成不会发生这种事情。这将是一个巨大的安全漏洞。
Canvas 是在页面上绘制的元素,它不授予对浏览器绘图系统的访问权限。此外,IE8 不支持画布,因此 IE8 支持是不可能的,尤其是在您不需要插件的情况下。
总而言之,没有。这是不可能的,甚至也不可取。
The API for Javascript's interactions with the browser are designed such that this sort of thing cannot happen. It would be a huge security hole.
Canvas is an element that is drawn to on the page, it does not grant access to the browser's drawing system. Furthermore, IE8 does not support canvas, so IE8 support is out the window, especially if you require no addons.
In summary, no. It is not possible, nor even advisable.