@@ -66,16 +66,18 @@ 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 )
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 ) && ! / S a f a r i / . test ( navigator . userAgent )
7173
7274var saveAs = _global . saveAs || (
7375 // probably in some web worker
7476 ( typeof window !== 'object' || window !== _global )
7577 ? function saveAs ( ) { /* noop */ }
7678
77- // Use download attribute first if possible (#193 Lumia mobile) unless this is a native macOS app
78- : ( 'download' in HTMLAnchorElement . prototype && ! isWebKit )
79+ // Use download attribute first if possible (#193 Lumia mobile) unless this is a macOS WebView
80+ : ( 'download' in HTMLAnchorElement . prototype && ! isMacOSWebView )
7981 ? function saveAs ( blob , name , opts ) {
8082 var URL = _global . URL || _global . webkitURL
8183 var a = document . createElement ( 'a' )
@@ -140,7 +142,7 @@ var saveAs = _global.saveAs || (
140142 var isSafari = / c o n s t r u c t o r / i. test ( _global . HTMLElement ) || _global . safari
141143 var isChromeIOS = / C r i O S \/ [ \d ] + / . test ( navigator . userAgent )
142144
143- if ( ( isChromeIOS || ( force && isSafari ) || isWebKit ) && typeof FileReader !== 'undefined' ) {
145+ if ( ( isChromeIOS || ( force && isSafari ) || isMacOSWebView ) && typeof FileReader !== 'undefined' ) {
144146 // Safari doesn't allow downloading of blob URLs
145147 var reader = new FileReader ( )
146148 reader . onloadend = function ( ) {
0 commit comments