0
which function can help me to open the page automatic After the number 5 decriment to 0 with javascript
hi guys please help me to get solutions
2 ответов
+ 1
So you could use something like these. Also you could write a small snippet to check the value to see if it == 0. If so then run one of the below functions.
if(myVar == 0) {
reloadPage();
}
// this will reload the current page after 5second
function reloadPage() {
setTimeout(location.reload.bind(location), 5000);
}
Or you could use something like this.
var childWindow = "";
var newTabUrl="http://google.com";
// this will open into a new tab
function openNewTab(){
childWindow = window.open(newTabUrl);
}
// this will open in the existing tab
function refreshExistingTab(){
childWindow.location.href=newTabUrl;
}
Hope this helps guide you in the correct direction.
0
thanks very much