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".
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
Thank you for your cooperation.
javascript windows ajax internet-explorer
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.
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.
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.
© 2024 OneMinuteCode. All rights reserved.