I go to the page, it has 1 zip file, but I don't know the name, other than its a .zip
.
I want Greasemonkey to download this zip automatically, maybe using flashgot or something?
So I need it to activate on page load, then look for *.zip
, and add that to downloads automatically.
Any ideas?
Tampermonkey is used to run so-called userscripts (sometimes also called Greasemonkey scripts) on websites. Userscripts are small computer programs that change the layout of a page, add or remove new functionality and content, or automate actions.
Technical details. Greasemonkey user scripts are written in JavaScript and manipulate the contents of a web page using the Document Object Model interface.
To access Greasemonkey's management pane, click on the downward arrow on the right side of the button Greasemonkey to the right of your URL bar and select Manage User Scripts. This opens a tab with a list of your scripts.
Greasemonkey, by itself, cannot automatically save zip-files, or anything else, to the local file system.
This is by design; allowing user/page JavaScript to save files is a proven security disaster.
Your options:
What GM can do is pop open the File-Save dialog for the correct file:
User interaction will still be required, if only one click.
For example, suppose the page contains this link:
<a href="http://Suspicious.com/TotallyOwnYourBankAndCreditCardAccounts.zip">
Click me, sucka!
</a>
Then this code will open the File-Save dialog for it:
var clickEvent = document.createEvent ('MouseEvents');
var firstZipFile = document.querySelector ("a[href*='.zip']");
clickEvent.initEvent ('click', true, true);
firstZipFile.dispatchEvent (clickEvent);
Greasemonkey can use GM_xmlhttpRequest() to send files to your web application -- which you will have to write. The web app can then save the file to the server automatically. You can set up your local machine to be the server.
For more help on this approach, read this and then ask a new question.
If you decide to take the Firefox add-on route, see "MDN: Downloading files".
For more help on this approach, read this and then ask a new question.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With