简体   繁体   中英

Highchart Export chart not returning image in IE8 or IE9

Please don't say my question is repeat as it's not and as I search a lot since last 5 hours. Very tough question but let see if someone can really help me out.

Ok so I am trying to get the generated chart- image url using Highchart Export server. My code is following and it's not returning any image url in IE8 or IE9. As if you can see my hidden input element stays empty but working nicely with chrome, firefox, safari and even IE edge and IE10 but not IE8 & IE9.

Here is code,

var obj = {}, chart;

chart = $('#graph<?php echo $i;?>').highcharts();
obj.svg = chart.getSVG();
obj.type = 'image/jpeg';
obj.width = 900;obj.height = 400;  
obj.async = true;
 <?php if (1) {?>  
$.ajax({
    type: 'post',
    url: chart.options.exporting.url,        
    data: obj, 
    success: function (data) {            
            //alert(data);
            var exportUrl = this.url,
            imgContainer = $("#imgContainer<?php echo $i;?>");                         
            var obj2 = exportUrl + data;
            document.getElementById('graphurl_<?php echo $i;?>').value = exportUrl + data;
            //var temp = exportUrl + data;
            //$("#graphurl_1").val(temp);

            //var imgie = document.getElementById("graphurl_1ie8");
            //imgie.setAttribute('src','jimils.com');
        }        
});

Not returning image url from export server please please help.

CORS is possible in IE8 and IE9 through the XDomainRequest object. We do some feature detection here

 if (window.XDomainRequest) { /*old IE*/ var xdr = new XDomainRequest(); xdr.open("post", 'http://export.highcharts.com/?' + dataString); xdr.onload = function () { console.log(xdr.responseText); $('#container').html('<img src="http://export.highcharts.com/' + xdr.responseText + '"/>'); }; xdr.send(); } else { $.ajax({ // jQuery ajax call ... }) } 

See this fiddle: http://jsfiddle.net/gvaartjes/vLaa7k57/1/

Gert

It is investigated by our developers. Thanks for the reporting.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM