@@ -66,16 +66,19 @@ function click (node) {
66
66
}
67
67
}
68
68
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 )
69
+ // Detect WebView inside a native macOS app by ruling out all browsers
70
+ // We just need to check for 'Safari' because all other browsers (besides Firefox) include that too
71
+ // https://www.whatismybrowser.com/guides/the-latest-user-agent/macos
72
+ var isMacOSWebView = / M a c i n t o s h / . test ( navigator . userAgent ) && / A p p l e W e b K i t / . test ( navigator . userAgent ) &&
73
+ && ! / S a f a r i / . test ( navigator . userAgent )
71
74
72
75
var saveAs = _global . saveAs || (
73
76
// probably in some web worker
74
77
( typeof window !== 'object' || window !== _global )
75
78
? function saveAs ( ) { /* noop */ }
76
79
77
- // Use download attribute first if possible (#193 Lumia mobile) unless this is a native macOS app
78
- : ( 'download' in HTMLAnchorElement . prototype && ! isWebKit )
80
+ // Use download attribute first if possible (#193 Lumia mobile) unless this is a macOS WebView
81
+ : ( 'download' in HTMLAnchorElement . prototype && ! isMacOSWebView )
79
82
? function saveAs ( blob , name , opts ) {
80
83
var URL = _global . URL || _global . webkitURL
81
84
var a = document . createElement ( 'a' )
@@ -140,7 +143,7 @@ var saveAs = _global.saveAs || (
140
143
var isSafari = / c o n s t r u c t o r / i. test ( _global . HTMLElement ) || _global . safari
141
144
var isChromeIOS = / C r i O S \/ [ \d ] + / . test ( navigator . userAgent )
142
145
143
- if ( ( isChromeIOS || ( force && isSafari ) || isWebKit ) && typeof FileReader !== 'undefined' ) {
146
+ if ( ( isChromeIOS || ( force && isSafari ) || isMacOSWebView ) && typeof FileReader !== 'undefined' ) {
144
147
// Safari doesn't allow downloading of blob URLs
145
148
var reader = new FileReader ( )
146
149
reader . onloadend = function ( ) {
0 commit comments