Graham
TECRIDIBLE It is still a landing page but it does an auto download on devices that allow it the page expect two query string variables 'file' and 'name'
<h2>Your download is starting</h2>
<div>Thank you for downloading {_$name| this file}</div>
<div> Your download will start Immediately<br />If not please click <a href="{_$file|}?download">Here</a></div>
<a href="<xt:referer />"><button>Go Back</button></a>
<script>
var fileToDownload = '{_$file|}';
window.downloadFile = function (sUrl) {
if (/(iP)/g.test(navigator.userAgent)) return false;
if (window.downloadFile.isChrome || window.downloadFile.isSafari) {
var link = document.createElement('a');
link.href = sUrl;
if (link.download !== undefined) {
var fileName = sUrl.substring(sUrl.lastIndexOf('/') + 1, sUrl.length);
link.download = fileName;
}
if (document.createEvent) {
var e = document.createEvent('MouseEvents');
e.initEvent('click', true, true);
link.dispatchEvent(e);
return true;
}
}
// for 'local' files set the following to ?__xt_download=1
var query = '?download';
window.open(sUrl + query, '_self');
}
window.downloadFile.isChrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
window.downloadFile.isSafari = navigator.userAgent.toLowerCase().indexOf('safari') > -1;
downloadFile(fileToDownload);
</script>
Copy code Demo
http://banana.madpath.com/go