Onload download

0

Hi, I would like to know how I can make a script that just load the page start a download, without any

  

< 'a href="" >

or anything that involves clicks. I searched everywhere but I did not find it. Greetings

    
asked by Cqmadrejo 10.03.2018 в 15:53
source

2 answers

0

uses the window onload event and points the location to the download url

<script type="text/javascript">
    window.onload = function() {
         window.location = 'url de descarga';
    }
</script>
    
answered by 10.03.2018 / 16:16
source
0

There are many ways to do it, my little grain of sand would be to try something like this:

In your JS create the function that performs the download And on the html you call the function when loading the body with the onload event.

function descarga() {
    window.location = 'http://www.jesuministrosymas.com.ve/LOGO.png';
}
<body LANG="es-VE" DIR="LTR" onload="descarga();">
 
</body>
    
answered by 11.03.2018 в 03:32