Do not want IE notification bar displayed when downloading files

Asked 1 years ago, Updated 1 years ago, 118 views

Using JavaScript to access a file on a server and create a program to open it in the client's exe.

It works as expected, but the notification bar of the browser (IE9) appears when I access the file on the server.I have to start exe without displaying this, but I'm having trouble because I don't know how to avoid it.
(The notification bar is the one that opens, saves, and cancels at the bottom of the browser screen.)

The code is as follows.Open "result.myext" when the sample.cgi call is successful.

new Ajax.Request("sample.cgi", {
    method: "post",
    parameters: "param=123",
    onSuccess: function() {
        window.location.href="result.myext";
    }
});

The notification bar appears when onSuccess processes it, for example, if you write window.location.href="result.myext" before new Ajax.Request, exe starts without the notification bar.Therefore, I believe that there are no errors in setting the MIME or registry.

If you know any solution to why onSuccess is not possible, please let me know.

The running client (Windows 7) already has the following settings in the registry for the extension "myext".

  • Associate the exe you want to run
  • EditFlags65536
  • BrowserFlags8

Also, the apache httpd.conf has the following settings for MIME "myext".

AddType application/myext.myext
<FilesMatch"\.myext$">
    Header set Content-Disposition inline
</FilesMatch>

Supplemental

  • The running client is Windows 7 or later.Browsers are limited to IE9 and later.
  • Windows XP and IE8 worked without displaying the Run/Save dialog, which corresponds to the notification bar in IE9.
  • Another way is to monitor the success of sample.cgi in the timer and open result.myext, but the notification bar appears.
  • The apache MIME setting seems to be able to launch the associated exe without it.
  • The server is Windows Server 2008 R2, Apache 2.0.65
  • prototype.js version uses 1.5.0.

Thank you for your cooperation.

javascript windows ajax internet-explorer

2022-09-30 21:12

2 Answers

The problem seems to be whether or not it was triggered by user action such as button click.Some browsers are $('input[type="file"]').click() must be in the click event before it can be executed.(We were unable to reproduce it with your PC browser at this time, but it is mentioned in this article and this article.)

In addition to this question, We were able to see it on IE9's virtual machine and IE11 at hand.

  • Operates within click events
  • Other events (such as mouseover), XHR (Ajax) events, setTimeout, etc. will not work

I think this phenomenon is very similar to this problem.

IE11 avoided by going through a page with only <metahttp-equiv="refresh"...>, but IE9 still seemed to get a notification bar. Although you can use the asynchronous:false option to block the main thread until you get a response.

First of all, consider redirecting without Ajax communication, or simply displaying a download link when Ajax is complete.


2022-09-30 21:12

Am I correct in understanding that if you run window.location.href outside Ajax.Request, the notification bar will not be displayed?
If so, there is no problem with HTTP header and client registry settings.
You can assume that the notification bar is displayed for security reasons because you are trying to make a page transition within another request context of ajax, but this area depends on the protocol.js implementation, so I can't say for sure right away.
Experimentally try this part alone with an implementation that does not use prototype.js.


2022-09-30 21:12

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.