I have read at least 40-50 posts on this topic and none of the solutions really do what i want. I 'command' my WinCE 6.0 board to create a backup file through AJAX request and then i want to save this file to local WS.
I have the following javascript code that is called once the AJAX request completes:
function DownloadControllerBackupDB(theResult)
{
if(typeof(theResult.Filename) != undefined)
{
var myFileLocation = '/data/' + theResult.Filename;
location.href = myFileLocation;
}
else
{
Error("Backup failed !");
}
}
I also tried this approach (instead of the 'location.href' technique):
function SaveToDisk(fileURL, fileName)
{
var save = document.createElement('a');
save.href = fileURL;
save.target = '_blank';
save.download = fileName || 'unknown';
var event = document.createEvent('Event');
event.initEvent('click', true, true);
save.dispatchEvent(event);
(window.URL || window.webkitURL).revokeObjectURL(save.href);
}
Both 'techniques' endup @ the same result in chrome 50, the file is indeed saved to disk in the local folder dedicated to user's file download...
I would want the browser to ask me (with a file requester) before saving this file to disk so i can decide where to put it.
I read somewhere that you can set an option in chrome (and probably other browsers) to force it asking before saving files but i think this is unacceptable to ask a user to do (due to the complexity of the operation).
Is there anyway to 'Force' the browser to ask before saving a linked file ?
Thanxs