@@ -2,30 +2,30 @@ module.exports = function(data, filename, mime, bom) {
2
2
var blobData = ( typeof bom !== 'undefined' ) ? [ bom , data ] : [ data ]
3
3
var blob = new Blob ( blobData , { type : mime || 'application/octet-stream' } ) ;
4
4
if ( typeof window . navigator . msSaveBlob !== 'undefined' ) {
5
- // IE workaround for "HTML7007: One or more blob URLs were
6
- // revoked by closing the blob for which they were created.
7
- // These URLs will no longer resolve as the data backing
5
+ // IE workaround for "HTML7007: One or more blob URLs were
6
+ // revoked by closing the blob for which they were created.
7
+ // These URLs will no longer resolve as the data backing
8
8
// the URL has been freed."
9
9
window . navigator . msSaveBlob ( blob , filename ) ;
10
10
}
11
11
else {
12
- var blobURL = window . URL . createObjectURL ( blob ) ;
12
+ var blobURL = ( window . URL ? window . URL : window . webkitURL ) . createObjectURL ( blob ) ;
13
13
var tempLink = document . createElement ( 'a' ) ;
14
14
tempLink . style . display = 'none' ;
15
15
tempLink . href = blobURL ;
16
- tempLink . setAttribute ( 'download' , filename ) ;
17
-
16
+ tempLink . setAttribute ( 'download' , filename ) ;
17
+
18
18
// Safari thinks _blank anchor are pop ups. We only want to set _blank
19
19
// target if the browser does not support the HTML5 download attribute.
20
- // This allows you to download files in desktop safari if pop up blocking
20
+ // This allows you to download files in desktop safari if pop up blocking
21
21
// is enabled.
22
22
if ( typeof tempLink . download === 'undefined' ) {
23
23
tempLink . setAttribute ( 'target' , '_blank' ) ;
24
24
}
25
-
25
+
26
26
document . body . appendChild ( tempLink ) ;
27
27
tempLink . click ( ) ;
28
-
28
+
29
29
// Fixes "webkit blob resource error 1"
30
30
setTimeout ( function ( ) {
31
31
document . body . removeChild ( tempLink ) ;
0 commit comments