File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -66,13 +66,16 @@ function click (node) {
6666 }
6767}
6868
69+ // Detect WebKit inside a native macOS app
70+ var isWebKit = / A p p l e W e b K i t / . test ( navigator . userAgent )
71+
6972var saveAs = _global . saveAs || (
7073 // probably in some web worker
7174 ( typeof window !== 'object' || window !== _global )
7275 ? function saveAs ( ) { /* noop */ }
7376
74- // Use download attribute first if possible (#193 Lumia mobile)
75- : 'download' in HTMLAnchorElement . prototype
77+ // Use download attribute first if possible (#193 Lumia mobile) unless this is a native macOS app
78+ : ( 'download' in HTMLAnchorElement . prototype && ! isWebKit )
7679 ? function saveAs ( blob , name , opts ) {
7780 var URL = _global . URL || _global . webkitURL
7881 var a = document . createElement ( 'a' )
@@ -137,7 +140,7 @@ var saveAs = _global.saveAs || (
137140 var isSafari = / c o n s t r u c t o r / i. test ( _global . HTMLElement ) || _global . safari
138141 var isChromeIOS = / C r i O S \/ [ \d ] + / . test ( navigator . userAgent )
139142
140- if ( ( isChromeIOS || ( force && isSafari ) ) && typeof FileReader !== 'undefined ') {
143+ if ( ( ( isChromeIOS || ( force && isSafari ) ) && typeof FileReader === 'object' ) || isWebKit && typeof FileReader === 'function ') {
141144 // Safari doesn't allow downloading of blob URLs
142145 var reader = new FileReader ( )
143146 reader . onloadend = function ( ) {
You can’t perform that action at this time.
0 commit comments