views:

1138

answers:

9

I want to add a button to one of our web sites that will allow the user to file a bug with our bug tracking system.

One of the feature requests is that a screen cap of the page in question be sent along.

Without installing something on the end users machine, how can I do this? Does javascript have some sort of screen cap api?

+3  A: 

No, javascript does not have anything like this.

I'm afraid that this will be quite hard. I can not think anything that would do this without installing on users computer.

I'd like to be proven wrong, but atleast this is an answer for you.

Mikko Tapionlinna
Unfortunately, I have to agree. You can't get the image without installing _something_ to the user's machine. What you _can_ do is send the exact _html_ or the user is viewing, but even that might be out of date if you've done a lot of DOM manipulation.
Joel Coehoorn
+1  A: 

See this question. Basically, no, not with javascript. Perhaps with ActiveX, but that's back to installing things on the client's PC.

Consider writing a server-side script that repeats the user's request exactly (assuming it's not after a POST) and storing the resulting html file.

Phil H
+6  A: 

You may grab the innerHTML of the page and then process it on the server:

document.getElementsByTagName('html')[0].innerHTML;
// this would also be interactive (i.e. if you've
// modified the DOM, that would be included)
moff
It's not exactly a screenshot, but, in a sense, it's better. You get to see not just what the page looked like, you get to see the state of the page at the time the user was viewing it.
Michael Todd
Note, however, that if a user's specific browser (or worse, their browser configuration) are to blame you won't be able to see the issue until you're able to recreate the user's environment.
AaronSieb
Also, if you've made changes to the DOM in javascript they may not show up like you expect.
Joel Coehoorn
The DOM changes part may be a deal breaker. We do a lot of ajax on these pages.
Chris Lively
Accepted because it was the closest thing.
Chris Lively
+1  A: 

You might look into using a web based solution such as the one offered at Super Screenshot! or WebShotsPro.com. Depending on your needs, such as screenshots of specific areas of pages, or pages inaccessible from the outside world, it may not work for you, but it is an idea.

BinaryMuse
This is an internal app, so going outside won't work. Good links though.
Chris Lively
+2  A: 

I agree with the other answers -- no dice.

However, there is a firefox plugin, the Pearl Crescent Page Saver, which might be worth looking into for related tasks.

jedierikb
+1  A: 

Take a look at pagecrop (implemented with jQuery + jCrop plug-in)

Imran
I don't think this will take a screenshot of the page. I just wraps it in an iframe, then reduce the view to specified parameters. No input data is saved, you don't get any useful debug info.
Martin
+2  A: 

I'd suggest some sort of integration with FireShot which is a Free Firefox/IE addon.

scunliffe
+2  A: 

I must be missing something, but can't you just...

Press PrtScr on keyboard and paste into email.

Brad
In fact Alt+PrtScn will copy just the active window to the clipboard, preventing copying surrounding windows with confidential information.
Andrew Arnott
This may work on a Windows machine, what about a Mac / LINUX / etc?
LarryH
They could do this, but it doesn't allow me to capture all of the other things I want from the page.
Chris Lively
+1  A: 

Get as much Info as you can about the user environment using jQuery. (jQuery.support) / user agent / cookies / form input values, the url (for get parameters and to know which page had an error)

Send the source of the page like mentionned by Moff. Try serializing the DOM as it is now so you can compare what is different from the original page.

It is also useful to send the source of the page if you need to keep it for historic purposes, since when you update the page, it will be become different.

Martin
why the downvote ?
Martin
Not sure why it was downvoted. This is a good suggestion.
Chris Lively