Go to another Page of my site and execute a button_click event

Hi everyone!
I´m new in this forum. I am making my site, and i’m trying to with a button in my home page go to another page (Page2) but when the Page2 will open, execute a "export function button1_click_1(event) " that i have in the Page2 code.

For go to the Page2 from the home page, i used the function wixLocation.to(“/Page2”). Thats works perfectly. But is any way to go to the Page2 with a click on the button1 to execute the "export function button1_click_1(event) " that i have in the Page2?

Thanks a lot for any help in this issue :slight_smile:

Why have the onClick event on page 2 as that will always require the user to click on something for it to work.

Why not just change it so that it happens at the same time that the page loads and put it in the page onReady function.

Hi givemeawhisky . Thanks for your reply.
In the page2 i dont need that the function of the button1_click_1(event) run always. For that i dont use that in the onReady function. The idea its that just if you click on a espcific button go to the page2 and activate the "export function button1_click_1(event) " , but in the site are others ways to go to the page2 and load it normally.

Again thanks for you reply. If you know a way to do that i´ll really appreciate