请不要说我的问题是重复的,因为它不是,因为我在过去5个小时后搜索了很多。 非常棘手的问题,但是看看是否有人可以帮助我。
好的,我正在尝试使用Highchart Export服务器获取生成的图表图像网址。我的代码是关注的,它没有返回IE8或IE9中的任何图像URL。好像你可以看到我的隐藏输入元素保持空白但与chrome,firefox,safari甚至IE edge和IE10很好地配合,但不是IE8& IE9。
这是代码,
var obj = {}, 图表;
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');
}
});
请勿从导出服务器返回图片网址,请帮助。
答案 0 :(得分:1)
通过XDomainRequest对象可以在IE8和IE9中使用CORS。我们在这里进行一些特征检测
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 ... })
}
&#13;
看到这个小提琴:http://jsfiddle.net/gvaartjes/vLaa7k57/1/
格特
答案 1 :(得分:0)
我们的开发人员对此进行了调查。感谢您的报道。