Is it possible to take a screenshot with javascript and save it? Because I use the drag script from dynamicdrive to make images kinda like a puzzle, so how could I use js to take a screenshot of the final image and save it to a folder?
Printable View
Is it possible to take a screenshot with javascript and save it? Because I use the drag script from dynamicdrive to make images kinda like a puzzle, so how could I use js to take a screenshot of the final image and save it to a folder?
More specifically, im making it offline, so i want a link that will take a screenshot, save it as a .jpg, .png (my choice) and save it to the root folder
No, it isn't possible.
If you know Java, however, you can use the Robot class to take a screenshot (given the user's permission).
You can however capture the location.href of the page and send the query to a perl script to your server using the html2png command. And make a new javascript array to display the images.
By the way u can download html2png from this: http://marginalhacks.com/Hacks/html2jpg/
Clever, but requires X11, which one doesn't usually find running on a server (contrary to what Dan Brown may think...).
Then I think that there is only one way to do it. Add that kind of functionality to JS 1.5 by downloading either spidermonkey or Rhino from mdc.
Heh :)
Unfortunately, I doubt the Mozilla Foundation would approve such a patch... ;)
Who knows if they do?? anyways it is a client side property.
Because it would be against the principles of browser-embedded ECMAScript, besides introducing hundreds of potential new security holes for a feature hardly anyone would use.
It is a client-side task, yes. That doesn't mean it must be done in ECMAScript.
This is too much work for something that doesn't matter.
Everyone will end up with the same resulting puzzle.
In that case, just have a copy of the original image they can save.
That's it.
Or, if the puzzle really is generated dynamically, just save it as a jpg before slicing it up for them.
And, the only other thing you'd need is a script verifying that they have successfully completed the puzzle.
And you're done.
Easy, right?
or you can use alexa's thumbnails.