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

Greetings, I'm Devendra Dode, a full-stack developer, entrepreneur, and the proud owner of Tutsmake.com. My passion lies in crafting informative tutorials and offering valuable tips to assist fellow developers on their coding journey. Within my content, I cover a spectrum of technologies, including 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. Whether you're starting out or looking for advanced examples, I provide step-by-step guides and practical demonstrations to make your learning experience seamless. Let's explore the diverse realms of coding together.

Leave a Reply

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