parent
15fdefcc19
commit
9042dabc95
@ -56,8 +56,10 @@ angular.module('izhukov.utils', [])
|
|||||||
.service('FileManager', function ($window, $q, $timeout, qSync) {
|
.service('FileManager', function ($window, $q, $timeout, qSync) {
|
||||||
$window.URL = $window.URL || $window.webkitURL
|
$window.URL = $window.URL || $window.webkitURL
|
||||||
$window.BlobBuilder = $window.BlobBuilder || $window.WebKitBlobBuilder || $window.MozBlobBuilder
|
$window.BlobBuilder = $window.BlobBuilder || $window.WebKitBlobBuilder || $window.MozBlobBuilder
|
||||||
var buggyUnknownBlob = navigator.userAgent.indexOf('Safari') != -1 &&
|
var isSafari = 'safari' in window
|
||||||
navigator.userAgent.indexOf('Chrome') == -1
|
var safariVersion = parseFloat(isSafari && (navigator.userAgent.match(/Version\/(\d+\.\d+).* Safari/) || [])[1])
|
||||||
|
var safariWithDownload = isSafari && safariVersion >= 11.0
|
||||||
|
var buggyUnknownBlob = isSafari && !safariWithDownload
|
||||||
|
|
||||||
var blobSupported = true
|
var blobSupported = true
|
||||||
|
|
||||||
@ -284,7 +286,7 @@ angular.module('izhukov.utils', [])
|
|||||||
}
|
}
|
||||||
|
|
||||||
var popup = false
|
var popup = false
|
||||||
if (window.safari) {
|
if (isSafari && !safariWithDownload) {
|
||||||
popup = window.open()
|
popup = window.open()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -297,7 +299,9 @@ angular.module('izhukov.utils', [])
|
|||||||
}
|
}
|
||||||
var anchor = document.createElementNS('http://www.w3.org/1999/xhtml', 'a')
|
var anchor = document.createElementNS('http://www.w3.org/1999/xhtml', 'a')
|
||||||
anchor.href = url
|
anchor.href = url
|
||||||
|
if (!safariWithDownload) {
|
||||||
anchor.target = '_blank'
|
anchor.target = '_blank'
|
||||||
|
}
|
||||||
anchor.download = fileName
|
anchor.download = fileName
|
||||||
if (anchor.dataset) {
|
if (anchor.dataset) {
|
||||||
anchor.dataset.downloadurl = ['video/quicktime', fileName, url].join(':')
|
anchor.dataset.downloadurl = ['video/quicktime', fileName, url].join(':')
|
||||||
|
Loading…
Reference in New Issue
Block a user