1window.downloadFile = function (sUrl) { 2 3 //iOS devices do not support downloading. We have to inform user about this. 4 if (/(iP)/g.test(navigator.userAgent)) { 5 alert('Your device do not support files downloading. Please try again in desktop browser.'); 6 return false; 7 } 8 9 //If in Chrome or Safari - download via virtual link click 10 if (window.downloadFile.isChrome || window.downloadFile.isSafari) { 11 //Creating new link node. 12 var link = document.createElement('a'); 13 link.href = sUrl; 14 15 if (link.download !== undefined) { 16 //Set HTML5 download attribute. This will prevent file from opening if supported. 17 var fileName = sUrl.substring(sUrl.lastIndexOf('/') + 1, sUrl.length); 18 link.download = fileName; 19 } 20 21 //Dispatching click event. 22 if (document.createEvent) { 23 var e = document.createEvent('MouseEvents'); 24 e.initEvent('click', true, true); 25 link.dispatchEvent(e); 26 return true; 27 } 28 } 29 30 // Force file download (whether supported by server). 31 var query = '?download'; 32 33 window.open(sUrl + query, '_self'); 34} 35 36window.downloadFile.isChrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1; 37window.downloadFile.isSafari = navigator.userAgent.toLowerCase().indexOf('safari') > -1;
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.