Download

Asked

Viewed 1,656 times

0

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 an Automatic Download, however if I place a href or windows Location for automatic download, it does not work. Is there any function in Jquery that when accessing the page automatically download without clicking any button?

The Gophish tool does not accept languages like PHP.

  • An aqruivo TXT, can have user interaction without problems, but needed this download. The project is precisely for security awareness.

1 answer

1


You can use the attribute download HTML5. Simply insert an event onclick and call it in the page loading:

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

See that I put a name other than the original in the attribute download. 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>
<a id="baixar" href="nome.txt" onclick="this.click()" download>Baixar TXT</a>

  • Good, that’s right. Thanks for another help.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.