Setting [removed] or window.open in AngularJS gives “access is denied” in IE 11

前端 未结 1 951
别跟我提以往
别跟我提以往 2020-12-03 05:13

I\'m admittedly an AngularJS newbie but I can\'t find why this code works in Chrome and Firefox but gives \"Access is denied\" in the javascript console with IE

1条回答
  •  执念已碎
    2020-12-03 05:42

    Saving text in a local file in Internet Explorer 10

    It looks like IE blocks window.open on blobs, but implemented their own functions for opening and saving blobs. Instead try

    if (window.navigator && window.navigator.msSaveOrOpenBlob) {
        window.navigator.msSaveOrOpenBlob(blob);
    }
    else {
        var objectUrl = URL.createObjectURL(blob);
        window.open(objectUrl);
    }
    

    0 讨论(0)
提交回复
热议问题