I have a set-up with multiple variables that users can alter that effect a visual representation of an element. All of this is controlled by jquery scripts. It would be cool if there was a way to save the resultant image as per what the browser renders. It'd be no different than a screencapture from a user perspective, though it would only capture the relevant area.
I have a plugin for FF called Page Saver, and it's functionality is pretty much what i am looking for, but with jquery or regular javascript if possible.
I'm more asking for tips, and a general direction that you guys would advise me to go in in order to pursue such functionality. I'd prefer not to learn another language to do this, but if i must...
There is no JS functionality built into browsers that would allow you turn an image into HTML sadly. So you would need something like a browser plugin or extension installed that has a JS API that you can call into. But even then, it would obviously require that plugin be installed on that persons browser.
Edit : This method only works in Firefox extensions.
You can use HTML5 canvas, Firefox' drawWindow and the toDataURL method. For example:
You can adjust
top
,left
,width
andheight
to capture only a part of the web page.The result is a data URI string. You can send it to your server or draw it on another canvas:
Your plugin probably uses this method. You can also check its source code.
Edit: To send it to your server with JQuery you can do something like that:
On the server side you'll have to decode the data URL.