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.
JavaScript
x
10
10
1
<input type="submit" name="add" class="buy" onClick="timeDelay()"/>
2
3
<script>
4
function timeDelay(){
5
setTimeout(function(){
6
window.location.reload(true);
7
},6000);
8
}
9
</script>
10