Skip to content

setTimeout function not working on firefox

I am trying to use

<input type="submit" name="add" class="buy" onClick="setTimeout('history.go(0);',2000);"/>

It reloads the page on click after two seconds in chrome but it doesnt work in Firefox.

I went through this Why does window.location.reload need setTimeout to work in firefox. It still didn’t work for me. Please help me find a way I can achieve my required functionality accross both browsers.


This is how I made it work.

<input type="submit" name="add" class="buy" onClick="timeDelay()"/>
    function timeDelay(){