Greasemonkey script to cancel Firefox download dialog popup

Scorpion Ghost

Elite Member
Executive VIP
Jr. VIP
Joined
Mar 22, 2013
Messages
8,731
Reaction score
10,288
I do a bit of botting, and sometimes my bots visit "rude" websites. These rude websites basically forcibly pop up a download dialog box when you visit them, like this:

firefox-download-dialog.png


Here is an example. If you visit this link, you'll get a download popup like that - https://myaddictive.com/musiques/tiboy-shalla.html?fiche=3044

So I was sure that Firefox had a native way of fully disabling downloads. I wanted to fully and completely disable these either by using about:config or an extension. But to my surprise there is no way to do it, and the only plugin that can do it basically allows me to set up a password for downloads, and then instead of getting the download box I get the password box. But I don't want to get any box. I want these popups to not appear at all ever, or at least to get automatically closed/cancelled whenever they appear.

This looks like something Greasemonkey could handle. But I'm not good with javascript, and there's not much help out there on Google for my specific need.

Can anyone make me a little Greasemonkey script that will auto close any such popup whenever it appears? @t-machine

Thanks
 
There is a way on firefox though

S99GqBP

Man I just tried setting the last 2 options from your screenshot to 0, and the download box still pops up. Also tried setting the 1st option from your screenshot to false, and it still pops up.

How should I set them?

p.s I'm using Firefox version 55.0.2 (older version, legacy, if you know when Firefox updated a year or two ago and messed everything up)
 
the last option is what you need, it takes a MIME type : "application/zip, application/octet-stream" for ZIP files for example.

here are most of the types that will trigger a download popup :
https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Complete_list_of_MIME_types

Also here is the docs for it :

http://kb.mozillazine.org/About:config_entries#Browser.
 
the last option is what you need, it takes a MIME type : "application/zip, application/octet-stream" for ZIP files for example.

here are most of the types that will trigger a download popup :
https://developer.mozilla.org/en-US...f_HTTP/MIME_types/Complete_list_of_MIME_types

Also here is the docs for it :

http://kb.mozillazine.org/About:config_entries#Browser.

browser. helperApps. neverAsk. saveToDisk String A comma-separated list of MIME types to save to disk without asking what to use to open the file. Default value is an empty string.

Doesn't this mean it will just proceed to save the file? I don't want files saved, and I don't want them opened either, I don't want that download prompt appearing at all. And if it must appear, I want it automatically closed somehow (so I thought Greasemonkey).

Maybe I'm not understanding what I'm reading correctly, but won't this options simply proceed to automatically save the file?
 
I also tried putting "audio/mpeg" for both:

browser. helperApps. neverAsk. openFile
browser. helperApps. neverAsk. saveToDisk

And it still opens the download dialog popup box.
 
Hmm, if you don't want the popup it might be hard, what are you using for automation? selenium? or just greasemonkey scripts?
 
Hmm, if you don't want the popup it might be hard, what are you using for automation? selenium? or just greasemonkey scripts?

I'm using iMacros, and it seems it's not possible to use iMacros to cancel this popup. Anyway at least not the free version, or the older version, or the Firefox extension of iMacros that I use (may be possible on paid and/or latest version and/or standalone iMacro browser, but not on what I use).

Couldn't Greasemonkey handle this?
 
I'm thinking... maybe I can disable download requests to the browser before they are made? Like some sort of method which would stop any website from sending a download request to my browser, therefore the download popup will never appear.

Does this sound doable? What would I be looking for?
 
Unfortunately I didn't find anything, it is a very active question : https://stackoverflow.com/questions/1176348/access-to-file-download-dialog-in-firefox

You can see almost all answers have code that modifies the same profile variable I showed you earlier.

It's also very unlikely there is a way for you to disable it. You don't know if a link is a download or not until you visit it, because the only difference between it and a normal page is the header it sends back.

(Also, if you use iMacros, I recommend the much stronger Kantu / UI Vision https://ui.vision/ )
 
Unfortunately I didn't find anything, it is a very active question : https://stackoverflow.com/questions/1176348/access-to-file-download-dialog-in-firefox

You can see almost all answers have code that modifies the same profile variable I showed you earlier.

It's also very unlikely there is a way for you to disable it. You don't know if a link is a download or not until you visit it, because the only difference between it and a normal page is the header it sends back.

(Also, if you use iMacros, I recommend the much stronger Kantu / UI Vision https://ui.vision/ )

Damn... I can't believe this is so impossible.

I guess one "retarded" solution would be to always save files in some folder, and then find a way to have that folder cleared out once per day or something. It would accomplish what I want, sort of.

I'm using Firefox portable. I wonder if I could go in the files and delete a few things and literally "rip out" the downloading functionality of the browser completely, so that when it tries to download anything it can't do it because the files/folders it requires to do so are simply not there. Hm...
 
Okay... well... I asked here, I asked on the iMacro forum, I asked on stackoverflow, I asked on Firefox portable forum, and I spent hours googling and thinking.

iMacros, Greasemonkey, stopping download requests before they happen, hacking Firefox itself, any solution would work, but at this point I can't solve this.

I'll wait a few days to see if I get any help anywhere, and if not, I'll probably just implement the only solution I see working.

1) Set all my browser to automatically download everything to the same folder
2) Create a batch file to empty out that folder
3) Create a batch file to empty out the recycle bin
4) Set the batch files to run once per day

Negative: I'll be downloading shit here and there and it would be eating up internet speed

Negative: The more downloading and deleting of files that's done, the faster the hard drive will die (not sure if this is true. It's just something I have stuck in my head. Maybe it doesn't apply for SSD drives... or maybe it applies even more on SSD drives, I don't know)

Negative: I may be downloading viruses and malware and stuff sometimes. But there's nothing of value on the computers I need this for, so, I don't care. I mean I care enough to list it as a negative but that's pretty much it.

Positive: I won't have to look at those stupid fucking download prompts piling up in my browsers when these invasive rude sites are visited. Won't have to take a second here and a second there to close them because I can't stand loose ends.

Statement: Fuck you Firefox for not offering an option to kill this. I mean, what about parental control? What if I had a kid and wanted to prevent the little fucker from downloading porn? Buuuu Firefox, Buuu!!!

BUUUUU FIREFOX!!!

 
I read you are using Imacros for automation.

Have you tried ONDOWNLOAD?
https://wiki.imacros.net/ONDOWNLOAD

Code:
ONDOWNLOAD CANCEL=YES

Yeah, I saw that, but down in the notes it says:

CANCEL
Stops automatic download from websites. Note, the CANCEL parameter is implemented in versions above iMacros v9.01 and is not available in iMacros for Firefox and Chrome yet.

I use iMacros 8.9.7 for Firefox, so from what I understand it won't work for me.
 
Yeah, I saw that, but down in the notes it says:

CANCEL
Stops automatic download from websites. Note, the CANCEL parameter is implemented in versions above iMacros v9.01 and is not available in iMacros for Firefox and Chrome yet.

I use iMacros 8.9.7 for Firefox, so from what I understand it won't work for me.

Then download Imacros v.9.0.1 and use it instead of using browser addon versions of Imacros.
 
Then download Imacros v.9.0.1 and use it instead of using browser addon versions of Imacros.

No. Um. It's not free. It has limitations. I have an entire operation set up and working very well with what I have, I'm not looking to change the version of iMacros I use. Thank you :)
 
No. Um. It's not free. It has limitations. I have an entire operation set up and working very well with what I have, I'm not looking to change the version of iMacros I use. Thank you :)

I use and code Macros for clients, and I have used both Firefox and Chrome versions of iMacros and also the standalone version which comes with a 30 days trial. I dont know about the change you are mentioning here, that has to be done when switching.

Anyways, good luck.
 
I use and code Macros for clients, and I have used both Firefox and Chrome versions of iMacros and also the standalone version which comes with a 30 days trial. I dont know about the change you are mentioning here, that has to be done when switching.

Anyways, good luck.

Well, first of all it's not free. Or the free version doesn't allow the use of databases and/or doesn't allow Event mode recording/clicking, and god knows what else.

I don't like big changes, and I don't like updates. If something works, it works, it's good, don't mess with it. If it ain't broken don't fix it :)

And this little issue I have here, I'll figure it out eventually. I'll either do what I last mentioned and simply download everything automatically and have it cleared out once per day automatically, or get a greasemonkey script to kill these prompts, or find a way to hack Firefox to remove the downloading functionality from the browser entirely.

Cheers :)
 
I solved this pesky thing.

I got an Autohotkey script created which will go through all my browsers where I get these download prompts and cancel them.

The script will run every 2 hours, go to the browsers one by one, and do 2 clicks on each on the same coordinates.

I just need to figure out how to position that download prompt so that it always appears in the exact same position on all the browsers. And I will place it somewhere where there is nothing "behind" the cancel button, so that even if there is no download prompt to be clicked on, the Autohotkey script will simply click in an empty spot, and basically do nothing.

Problem solved. It's not a perfect solution, it would have been much better if I could completely disable download prompts on my Firefox, or at least have them auto-close as soon as they appear. But if you read this thread you'll see I tried and considered everything my mind could conceive, and nothing works. So this solution with an Autohotkey script is good enough.

Stupid firefox not allowing me to disable download prompts completely fascists forcing that shit on me :D
 
Back
Top