save image with IE9+

130 views
Skip to first unread message

魏愛花

unread,
Mar 20, 2014, 2:33:09 PM3/20/14
to flo...@googlegroups.com
I used the example : Download Image
That works in every browser but IE...
It seems not work when I press the button: Download in IE.
I found the following code :

Flotr.addPlugin("download", {
        saveImage: function (type, e, f, g) {
            var h = this.options.grid,
                image;
            if (Flotr.isIE && Flotr.isIE < 9) return i = "<html><body>" + this.canvas.firstChild.innerHTML + "</body></html>", window.open().document.write(i);
            if (type !== "jpeg" && type !== "png") return;
            image = c(type, this.canvas, this.ctx, this.canvasWidth, this.canvasHeight, h && h.backgroundColor || "#ffffff");
            if (_.isElement(image) && g) this.download.restoreCanvas(), D.hide(this.canvas), D.hide(this.overlay), D.setStyles({
                    position: "absolute"
                }), D.insert(this.el, image), this.saveImageElement = image;
            else return window.open(image.src)
        },
        restoreCanvas: function () {
            a.show(this.canvas);
            a.show(this.overlay); 
            if(this.saveImageElement)  this.el.removeChild(this.saveImageElement);
            this.saveImageElement = null;
        }
    })

I notice that Flotr.isIE will return the version of IE, but it will just open a new tab with a blank.
Anyone knows how to fix it or how to save picture in this way.
thanks for replying.

khushboo Vashi

unread,
Aug 5, 2015, 5:37:53 AM8/5/15
to flotr2
I have been also facing same issue. Any idea how can we fix?
Reply all
Reply to author
Forward
0 new messages