Refreshing Screen

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



アプリ関連ニュース

お問い合わせはこちら

お問い合わせ・ご相談はお電話、またはお問い合わせフォームよりお受け付けいたしております。

tel. 06-6454-8833(平日 10:00~17:00)

お問い合わせフォーム