which function can help me to open the page automatic After the number 5 decriment to 0 with javascript | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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

18th Jul 2018, 9:17 AM
Alven
Alven - avatar
2 Answers
+ 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.
18th Jul 2018, 10:09 AM
ihateonions
0
thanks very much
18th Jul 2018, 10:14 AM
Alven
Alven - avatar