[Fixed]-Wait 5 seconds before download button appear

1πŸ‘

βœ…

The only secure way would be to put the logic on the server that checks the time. Make an Ajax call to the server. If the time is under 5 seconds, do not return the HTML, if it is greater than , than return the html to show.

Other option is to have the link point to your server and if the time is less than five seconds it redirects them to a different page. If it is greater than 5, it will redirect them to the correct content.

Either way, it requires you to keep track of session time on the server and remove it from the client.

πŸ‘€epascarello

0πŸ‘

You can use ajax, retrieve the button source code from your back end and intert it on your page.

Something like

$.get('url', function(sourceCode) {
    $('#midiv').html(sourceCode);
});
πŸ‘€sbaglieri

0πŸ‘

Use server side timeout.. whenever there is (AJAX) request from client for download link with timestamp, compare the client sent timestamp with currenttime and derive how much time is required to halt the request at server side to make up ~5 seconds. So by comparing timestamp you can almost achieve accuracy of waiting time as the network delays would be taken into account automatically.

πŸ‘€vinayakj

Leave a comment