Refreshing Screen
- 2020年3月23日
- 技術情報
Today, I would like to show you how to refresh the screen at some interval time using various ways.
Using setTimeout
<!DOCTYPE html>
<html>
<head>
<title>Page Reload after 10 seconds</title>
</head>
<body>
<h2>Hello</h2>
</body>
<script type="text/javascript">
setTimeout(function(){
location.reload();
},10000);
</script>
</html>
Using setInterval
<!DOCTYPE html>
<html>
<head>
<title>Page Reload after 10 seconds</title>
</head>
<body>
<h2>Hello</h2>
</body>
<script type="text/javascript">
function autoRefreshPage()
{
window.location = window.location.href;
}
setInterval('autoRefreshPage()', 10000);
</script>
</html>
Using Meta
<!DOCTYPE html>
<html>
<head>
<title>Page Reload after 10 seconds</title>
<meta http-equiv="refresh" content="10" />
</head>
<body>
<h2>Hello</h2>
</body>
</html>
By Yuuma
yuuma at 2020年03月23日 11:00:33