Internet explorer has a security setting, which allows enable/disable file download. There is a button in our application which which opens the file (e.g. .xls) with window.open
("fileurl"). Is it possible to detect in javascript that the download was blocked (and e.g. show some explanation)? Or more sophisticated is it somehow possible to detect it from request header?
Edit:
I have tried ajax, as suggested, to test download with no success. I suppose that saving or opening file is blocked not actual download.
var xhr = new XMLHttpRequest();
xhr.open("GET", docurl, false);
xhr.send(null);
var data = new VBArray(xhr.responseBody).toArray();//IE9 only
It succeeds and returns an array of the same length whether is the download disabled or not.
Getting and Sending Binary Files with XMLHttpRequest
how do I access XHR responseBody (for binary data) from Javascript in IE?
Edit 2:
My second attempt:
var wnd = window.open()
wnd.load=tst;
wnd.location.href= docurl
I tried to evalueat window in on load (tst) but I did not find difference with download prohibited or not.