문제

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/

도움이 되었습니까?

해결책

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.

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top