How to detect a prohibited file upload?

Internet Explorer has a security setting that allows you to enable / disable file downloads. Our application has a button that opens a file (eg .xls) with window.open

("fileurl"). Is it possible in javascript to detect that the download has been blocked (and, for example, show some kind of explanation)? Or more complex, one way or another, you can detect it from the request header?

Edit:
I tried ajax as suggested for testing with no success. My guess is that saving or opening the file is not blocked by the 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 loading is disabled or not.
Getting and sending binaries using XMLHttpRequest
how do I access the 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 display a window on boot (tst) but I could not find any difference with boot disabled or not.

+3


source to share


2 answers


Now there is an answer for about a month, so I concluded that there is no solution.



0


source


Here's the idea: ask the ajax request to load a "test file" similar to the one that's blocked, with the same mime type and a real empty type file if possible (but small, maybe 2KB). Then if such a download fails, ... you can also check how it is happening (quietly, with an error message, ...) .. this will give you more information on how to solve this.



+3


source







All Articles