2

I have two files, which is index.html and myfile.html,in index.html there is a link to redirect another page like Download and in myfile.html file, there is a button like

<button onClick="$('.table').tableExport({type:'excel',escape:'false'});" class="btn btn-default btn-xs pull-right"><i>Excel</i></button>

If user click this button from myfile.html, excel file will be download.So its two steps right? What I want to do is like when user click a link from index.html, I want to download directly, like opening another page and downloading the file. Is there anyway to do like this?

1 Answer 1

1

Give a selector to the download button and trigger the click event when user redirect to the myfile.html. Like :

On load of the myfile.html, put this script on that

$("download_button_selector").trigger("click");
Sign up to request clarification or add additional context in comments.

2 Comments

is there any function to wait 5 sec to trigger the click event ? because its too fast, my data is loading at that time like 3 sec needed to be fully show. Thanks bro anyway
Yeah, you can use setInterval for prevent the action for a certain time period

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.