Answer the question
In order to leave comments, you need to log in
Is it possible to open a file upload confirmation window in Google Chrome?
Hello, friends!
There is a site. Programs (for example, exe-files) are downloaded from it. It is necessary that the user, when clicking on a link with a file, receive a request to save (Save / Cancel or something like this in other browsers). Google Chrome is missing a file download confirmation prompt. :( Is it possible to implement this somehow?
ps We are talking about a standard request.
Thank you.
Answer the question
In order to leave comments, you need to log in
Well, strictly speaking Chrome asks for confirmation when downloading certain types of files (exe, pdf, deb, etc).
As I understand it, the essence of the task is for the user to confirm his desire to download the file / accept the terms of use?
There is a standard confirm() dialog or you can make a modal window on js.
Or do you need something like hotlink protection? So that a confirmation window appears when accessing a file on the server and not necessarily from the site.
I understand that what I will offer now is old school and overkill, but you can make a Java Applet that will ask where to save the file, and then download it yourself.
Chrome has a download behavior setting:
And by default, the dialog box is disabled and, as far as I understand, it is impossible to find out the status of this item on the client. On the other hand, most often people have it disabled deliberately and there is no need to override what the user himself has chosen. Moreover, by stupidly hardcoding such a solution for chrome, you doom people with a non-default setting to a double dialog box.
I tried to solve the problem with a notification, but Chromium sometimes gives an additional message in such windows: "Prevent the creation of additional windows on this page" with a checkmark.
And why should he? The file is downloaded immediately - if you need to open it, then right in the process of downloading you can click on it, it will open.
I have always disliked these dialogues, they distract from more important things.
Well, there seems to be only one. Prompts you to specify where to save the file. Accordingly, there you can click cancel and do not download. Unfortunately there is no other
In general, the task is as follows: it is necessary that the user must confirm the download of the file. In all browsers except Chrome, this confirmation is in the form of a Save / Cancel dialog. That's why I thought that maybe there is some way to ask the browser to give such a dialog (Save as ...).
Personally, only this way came to my mind: to identify the user by Webkit and give him a link with a JS window instead of a direct link, in which there will already be a direct link. But these are some kind of crutches :((((((((
So you can do that, if the browser is Chrome, then display some jQuery dialog with confirmation and only then the standard browser window. Not an option?
Serve the file with a script, sending a header:
Content-Disposition: attachment; filename="your_file.zip"
You can also specify the file type with a header:
Content-Type: application/zip
This will force the save / open file dialog box.
There is a list of extensions for which there is a mandatory request - executable, for example.
The window on the javascript - well, the toad script can be turned off, and here you won’t know anything either - I don’t know if the presence of a toad is written in the headings.
Of the options, in general html5, a flash loader to provide for all possible window options.
Safari doesn't ask either, it downloads right away and it's super-mega-duper convenient.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question