ItSolutionStuff.com

JQuery Reload Page After 5 Seconds Example

By Hardik Savani • November 5, 2023
jQuery

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.

I hope it can help you...

Hardik Savani

Hardik Savani

I'm a full-stack developer, entrepreneur, and founder of ItSolutionStuff.com. Passionate about PHP, Laravel, JavaScript, and helping developers grow.

📺 Subscribe on YouTube

We Are Recommending You

JQuery Moment Add Days to Date Example

Read Now →

How to Remove Element from Array in JQuery?

Read Now →

JQuery Get Days Difference Between Two Dates Example

Read Now →

How to Remove Key Value from Array using JQuery?

Read Now →

How to Get Selected Radio Button Value in JQuery?

Read Now →

JQuery Rotate Image Animation Example Code

Read Now →

How to Stop Setinterval() After Sometimes in JQuery?

Read Now →

JQuery Datepicker Example using JQuery UI JS

Read Now →

How to Create Scroll to Top of the Page by JQuery Animate?

Read Now →

How to Redirect Another Web Page in JQuery?

Read Now →

Check and Uncheck All Checkbox using JQuery Example

Read Now →

How to Allow Only One Checkbox Checked at a Time in JQuery?

Read Now →

How to Convert Line Breaks to br in jQuery ?

Read Now →

How to Check Object is Empty or Not in JQuery?

Read Now →