mmhan
mmhan

Reputation: 731

Is there anyway for JavaScript to take a screenshot of silverlight element?

Ground rules:

  1. No flash
  2. No add-ons
  3. 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.

Upvotes: 0

Views: 182

Answers (3)

Jignesh.Raj
Jignesh.Raj

Reputation: 5987

yes it's possible...

use below code

 <WebBrowser Grid.Row="1" VerticalAlignment="Top" Source="{Binding VodeoUrl,Mode=OneWay}" Height="280" Width="280"/>

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();

Upvotes: 1

Mario
Mario

Reputation: 2942

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.

Upvotes: 0

detaylor
detaylor

Reputation: 7280

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.

Upvotes: 1

Related Questions