Download Automatically

1

I have a project that uses GoPhish for internal campaigns. This tool has an HTML editor that generates the page in question. The problem I need to be allocated on this page is an Automatic Download, but if I put a href or windows location for automatic download, it does not work. Is there a function in Jquery that automatically accesses the page without having to click any button?

The GoPhish tool does not accept languages like PHP.

    
asked by anonymous 07.03.2018 / 23:07

1 answer

1

You can use the download attribute of HTML5. Just insert a onclick event and call it on page load:

$(document).ready(function(){
   $("#baixar").click();
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script><aid="baixar" href="nome.txt" onclick="this.click()" download="umnomediferente.txt">Baixar TXT</a>

Notice that I put a different name than the original in the download attribute. If you want the name to be the same, just leave download :

$(document).ready(function(){
   $("#baixar").click();
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><aid="baixar" href="nome.txt" onclick="this.click()" download>Baixar TXT</a>
    
07.03.2018 / 23:59