Automatically Refresh or Reload a Page using jQuery Example

Automatically Refresh or Reload a Page using jQuery Example

jQuery automatic refresh or reload a page; In this tutorial, you will learn how to automatically refresh or reload web page or html elements like div, span, and other tags using jQuery.

Sometimes, you need to automatically refresh or reloading the web page. So, this tutorial will guide you on how to automatically refresh or reload a web page using jQuery and HTML meta property.

How to Automatically Refresh Or Reload Web Page in jQuery

There are simple three methods to reload or refresh page using jquery; as shown below:

Method 1 – jQuery Refresh or Reload Page using Settimeout

Now, you will learn how to refresh or reload web page using jQuery setTimeout method. See the following example:

<head>
    <title>Jquery Page Reload after 10 seconds - Tutsmake.com</title>  
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script>
</head>
<body>
    <h2>Hello, I am Tutsmake.com</h2>
    <script type="text/javascript">
        setTimeout(function(){
            location.reload();
        },15000);
    </script>
</body>
</html>

Method 2 – jQuery Refresh or Reload Page using setInterval

Now, you will learn how to refresh or reload web page using jQuery setInterval method. See the following example:

<html lang="en">
<head>
    <title>Page Reload after 10 seconds - Tutsmake.com</title>
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script>
</head>
<body>
    <h2>Hello, I am Tutsmake.com</h2>
    <script type="text/javascript">
        function autoRefreshPage()
        {
            window.location = window.location.href;
        }
        setInterval('autoRefreshPage()', 15000);
    </script>
</body>
</html>

Method 3 – jQuery Refresh or Reload Page using meta data

Now, you will learn how to refresh or reload web page using meta. See the following example:

<html lang="en">
<head>
    <title>Page Reload after 10 seconds - Tutsmake.com</title>  
    <meta http-equiv="refresh" content="10" />
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script>
</head>
<body>
    <h2>Hello, I am Tutsmake.com</h2>
</body>
</html>

Recommended jQuery Tutorials

AuthorAdmin

My name is Devendra Dode. I am a full-stack developer, entrepreneur, and owner of Tutsmake.com. I like writing tutorials and tips that can help other developers. I share tutorials of PHP, Python, Javascript, JQuery, Laravel, Livewire, Codeigniter, Node JS, Express JS, Vue JS, Angular JS, React Js, MySQL, MongoDB, REST APIs, Windows, Xampp, Linux, Ubuntu, Amazon AWS, Composer, SEO, WordPress, SSL and Bootstrap from a starting stage. As well as demo example.

Leave a Reply

Your email address will not be published. Required fields are marked *