当我用new关键字初始化一个变量(backbone.js模型)时,它在所有最新的浏览器(chrome和firefox)中都有效。但在Firefox41中却无效。
var backboneModel = new BackboneModel();
控制台中的错误(仅firefox41)为
TypeError: BackboneModel is not a constructor
有线索吗?
更新
我成功回调了导致此问题的原因。在new Blob语句之后出现以下错误
SyntaxError: missing ; before statement
于
success: function(model, response){
// Create a new Blob object using the
//response data of the onload object
var blob = new Blob([response], {type: 'text/csv'});
//Create a link element, hide it, direct
//it towards the blob, and then 'click' it programatically
let a = document.createElement("a");
a.style = "display: none";
document.body.appendChild(a);
//Create a DOMString representing the blob
//and point the link element towards it
let url = window.URL.createObjectURL(blob);
a.href = url;
a.download = 'Sample_Report.csv';
//programatically click the link to trigger the download
a.click();
//release the reference to the file by revoking the Object URL
window.URL.revokeObjectURL(url);
}
1条答案
按热度按时间pnwntuvh1#
var backboneModel = new Backbone.Model()
中似乎缺少一个.