1

Every two minutes i want to check whether i received some message so want to reload my page every 2 minutes how to reload my php page using javascript

1
  • May I ask why? usually you just want to refresh a section of the page Commented Jun 17, 2010 at 4:50

6 Answers 6

11
<body onload="setInterval('window.location.reload()', 120000);">
Sign up to request clarification or add additional context in comments.

1 Comment

simple and effective :)
3

Why are you sticking on javascript. You can do this without Javascript too. <meta http-equiv="refresh" content="2;url=http://path/to/the/page" />

2 Comments

Hi Its working good is there any advantage of using this in meta tag instead of using in javascript
If the user has javascript disabled this will continue to work :)
0

Quick and dirty:

setTimeout( function() {
    location.reload()
}, 120000);

Though I think there could possibly be a fancier way of doing this, this is just what I know though.

Comments

0

I recommend looking into doing it with ajax. Look at the jQuery library, or any of the JavaScript libraries.

http://jquery.com/

Comments

0
      <meta http-equiv="refresh" content="n">

What if your client doesn't have javascript e.g feature phone browsers? Put that in the head folder of your HTML header. n is the number of seconds for the refresh intervals.

Comments

0

The easiest way I found out which is also javascript proof.

This code goes in between the HEAD tags.

<META HTTP-EQUIV="refresh" CONTENT="15">

The above code reloads the page every 15 seconds. Change 15 to the desired value as required. For eg; 300 for a page to reload every 5 minutes.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.