Refreshing the html page for regular interval time with javascript
One of my friend asked to refresh the HTML page in his project that changes the stock rates every one minutes.i gave him simple solution like
example:1
7 8 9 10 11 12 13 | <script> var timer; function refreshmypage(){ document.location=document.location.href; } timer=setTimeout(refreshmypage,60*1000); </script> |
Add above script after your HTML body content.Here setTimeout function takes two arguments one for function handler and other time to call the function,the time is in milliseconds.so i set to 60* 1000 i.e 60 seconds.
Example :2
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | <html> <head> <script type="text/javascript"> function load() { setTimeout("refresh()", 2000) } function refresh(){ window.location.reload() load() } </script> </head> <body onload="load()"> </body> </html> |
Above example also can be used.









Related Articles
8 users responded in this post
I was just now looking for information about this when I discovered your blog post. I’m just visiting to say that I very much liked seeing this post, it’s very well written. Are you thinking of posting more on this? It seems like there is more material here for future posts.
Thank you,
Actually i am busy with my regular job and freelance job,even i will try to update the site in regular interval.if you have any queris you can ask here.
The article on antibiotics are very good.
Nice post — this really hits home for me.
http://www.maheshchari.com – cool!!!!
You know, I didn’t even see Casper’s comment when I made mine (how could I miss that?). Sorry Casper, you had it first!
Hello. I think the article is really interesting. I am even interested in reading more. How soon will you update your blog?
Thanks for sharing. The slogan on the one waffle is killing me.
The best information i have found exactly here. Keep going Thank you
Leave A Reply