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.
Advertisement
Answer
This is how I made it work.
<input type="submit" name="add" class="buy" onClick="timeDelay()"/> <script> function timeDelay(){ setTimeout(function(){ window.location.reload(true); },6000); } </script>