Question

I create img element with a jquery plugin.

I would like to be able to click a button element and dowload the img element.

Is it possible without HTML5?

I do not store the image, cause it is created on the fly by jquery.

i'm using this plugin to create the img: http://www.class.pm/files/jquery/jquery.uqr/demo/

Was it helpful?

Solution

Since this is from a different domain, you won't be able to access image contents, unless you try to use CORS - and even then, there's very limited browser support. Use this plugin instead and then use toDataURL() to save it.

OTHER TIPS

The plugin you linked is using Google's deprecated Image Charts portion of Google Charts. Since the images come from a remote server, you can't access them (from JavaScript. Of course you can load them) from your domain (it would be a form of XSS). You can make a PHP script to download a chart and change the Content-Type. When the client requests a PHP script that returns a document with Content-Type application/octet-stream, the download will commence.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top