Automatically Refresh or Reload a Page using jQuery Example

Automatically Refresh or Reload a Page using jQuery Example


tutorials -

If you require to make auto refresh your web page after some time period using jquery or code javascript then you can do it you can do it using javascript. we will auto reload page using setTimeout(), setInterval() and meta http-equiv tag. we can simple do it in php, .net, java, laravel, codeigniter etc.

Sometimes, we require to reload page after every 5 seconds, 10 seconds, 15 seconds, 20 seconds, 25 seconds, 30 seconds etc. In this post i will explain how to do it and there are many way to refresh html page. So here you will see three example of auto refresh php page using javascript, you can also manually interval time of page refresh. So let's see bellow examples:

There are listed examples bellow:

1)Example 1(Using setTimeout)

2)Example 2(Using setInterval)

3)Example 3(Using meta)

Example 1(Using setTimeout)

<!DOCTYPE html>

<html>

<head>

<title>Page Reload after 10 seconds</title>

</head>

<body>


<h2>Hi, I am Itsolutionstuff.com</h2>


</body>


<script type="text/javascript">

setTimeout(function(){

location.reload();

},10000);

</script>

</html>

Example 2(Using setInterval)

<!DOCTYPE html>

<html>

<head>

<title>Page Reload after 10 seconds</title>

</head>

<body>


<h2>Hi, I am Itsolutionstuff.com</h2>


</body>


<script type="text/javascript">

function autoRefreshPage()

{

window.location = window.location.href;

}

setInterval('autoRefreshPage()', 10000);

</script>

</html>

Example 3(Using meta)

<!DOCTYPE html>

<html>

<head>

<title>Page Reload after 10 seconds</title>

<meta http-equiv="refresh" content="10" />

</head>

<body>


<h2>Hi, I am Itsolutionstuff.com</h2>


</body>

</html>

Above three example, will auto refresh after every 10 seconds, you can also modify it. because it's very simple.

Trending On Tutorial Stuff

Our Sponsors

NodeJS Experts
React Experts
PHP Experts
AngularJS Experts
Aws Experts
Firebase Experts

Top Applications in Tutorial Stuff

Top Experts In Tutorial Stuff