Is it possible to trigger forward button on the browser by clicking an HTML element? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Is it possible to trigger forward button on the browser by clicking an HTML element?

I have a BUTTON that if I click will lead to a NEW PAGE. The new page is progressive and constantly changing due to a setInterval function. When I go back and click the BUTTON again the NEW PAGE load from the begining, of course. But if I use forward button, the NEW PAGE appears at the state it was left before I go back. Can I trigger the forward button by clicking the BUTTON? I hope my question makes sense.

13th Oct 2018, 11:09 AM
Fernando Moceces
Fernando Moceces - avatar
2 Answers
+ 1
function goForward() { window.history.forward(); }
14th Oct 2018, 5:44 AM
JME
+ 1
Thank you! 😀
14th Oct 2018, 7:02 PM
Fernando Moceces
Fernando Moceces - avatar