JavaScript~~送信&受信ファイルフロー
2292 ワード
var url = "/map/download?_beanid="+_beanid+"&buttonid="+buttonid;
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.responseType = "blob";
xhr.onload = function() {
if (this.status == 200) {
//var blob = this.response;
var blob = new Blob([this.response]);
/*if(d.headers('content-disposition').indexOf('filename') != -1){
downloadTitle = d.headers('content-disposition').split(';')[1].split('=')[1];
downloadTitle = decodeURI(downloadTitle);
} */
if(typeof window.navigator.msSaveBlob !== 'undefined'){
window.navigator.msSaveBlob(blob, downloadTitle);
}else{
var objectUrl = URL.createObjectURL(blob);
var aForExcel = $("エクセルをダウンロード").attr("href",objectUrl);
$("body").append(aForExcel);
$(".forExcel").click();
aForExcel.remove();
}
var _h = $(window).height();
var $div=$("");
$div.dialog({
"modal": true,
"resizable": false,
"showmax":false,
"maxHeight": false,
"maxWidth": false,
"minHeight": 600,
"minWidth": 50,
"width":"100%",
"height":_h,
"draggable":false,
"title":filename,
"open":function(){
var $ifr = "