There are multiple solutions for this. If you want the page to be refreshed you actually don’t need JavaScript, the browser can do it for you if you add this meta tag in your head tag.
Example
<meta http-equiv=”refresh” content=”30″/>
The browser will then refresh the page every 30 seconds.
You can refresh a web page using JavaScript location.reload method. This code can be called automatically upon an event or simply when the user clicks on a link. If you want to refresh a web page using a mouse click, then you can use the following code:
<a href=”javascript:location.reload(true)”>Refresh Page</a>
To understand it in better way you can Refresh Page.
Auto Refresh
You can also use JavaScript to refresh the page automatically after a given time period. Here setTimeout() is a built-in JavaScript function which can be used to execute another function after a given time interval.
Example
Try the following example. It shows how to refresh a page after every 5 seconds. You can change this time as per your requirement.
<html>
<head>
<script type=”text/JavaScript”>
<!–
function AutoRefresh( t ) {
setTimeout(“location.reload(true);”, t);
}
//–>
</script>
</head>
<body onload=”JavaScript:AutoRefresh(5000);”>
<p>This page will refresh every 5 seconds.</p>
</body>
</html>
Output
This page will refresh every 5 seconds.
(Visited 85 times, 1 visits today)
TÍN NGHĨA – Đơn vị chuyên cung cấp dịch vụ công nghệ thông tin với chi phí hợp lý nhất, phục vụ cho mọi đối tượng, …
Liên hệ với TINNGHIA ngay hôm nay để có báo giá tốt nhất:
Email: tinnghiaco39@gmail.com – Hotline: 0915.631.868 – 0986.020.123
Webiste: www.tinnghiaco.com
Facebook: facebook.com/dntinnghia
Trong trường hợp tổng đài BẬN LIÊN TỤC hoặc QUÁ TẢI đơn hàng, Quý khách vui lòng để lại thông tin của mình thông qua biểu mẫu liên hệ hoặc tin nhắn để TINNGHIA liên hệ lại và giải đáp mọi thắc mắc của Quý khách trong thời gian sớm nhất.
Xin chân thành cảm ơn Quý khách đã quan tâm tới dịch vụ của TINNGHIA./.
Anonymous