Problem with web screenshots requiring authentication
I am making an application that takes a screenshot of the url requested by the user. I want to make it as transparent as possible when sites requiring username and password are questionable.
For example, if a user wants to take a screenshot on their iGoogle page, they will submit the server URL, but the screenshot will not be the same as the one they see on their screen.
Is there a way to do this? My guess is that in such cases I would have to actually request a screenshot from the user. Perhaps the user can even deliver their cookie to me for that domain.
Any thoughts?
Ty.
a source to share
Yes, in most cases you will need user cookies.
If the site uses regular cookies, you can create a bookmarklet that reads document.cookie
. This will not work with httpOnly
cookies that are most commonly used for sessions.
Some sites restrict sessions to a specific IP address, in which case you cannot take a screenshot without asking for proxying through the user's computer.
If you can force the user to use bookmark, an interesting trick would be to read and send the DOM to your server:
image.src = 'http://example.com?source=' +
escape(document.documentElement.innerHTML);
For HTTP authentication, the easiest way is to ask the user for a username / password.
a source to share