106

I'm trying to refresh the same page but it isn't working. This is my HTML code:

<html>
  <head>
    <title>HTML in 10 Simple Steps or Less</title>
    <meta http-equiv=”refresh” content=”5" />
  </head>
  <body>

  </body>
</html>
2
  • 3
    Ooops sorry, the question was because of the odd weide quote likish marks. I accidentally corrected it. I'm tied and my arse is numb, if thats any consolation
    – abc
    Commented Nov 24, 2021 at 3:08
  • 1
    Can you revert that edit? Took me a while to figure out why his code didn't work since you fixed it.
    – Zock77
    Commented Nov 24, 2021 at 19:57

6 Answers 6

234

It looks like you probably pasted this (or used a word processor like MS Word) using a kind of double-quotes that are not recognized by the browser. Please check that your code uses actual double-quotes like this one ", which is different from the following character:

Replace the meta tag with this one and try again:

<meta http-equiv="refresh" content="5" >
3
  • 1
    Is there a way to specify when to stop auto-refreshing. For example, if the page is left up accidently I wouldn't want it to keep auto-refreshing indefinitely.
    – Rod
    Commented Jan 19, 2016 at 23:49
  • 1
    @Rod Then you would need a system that "detects" how long your computer have been there. localStorage that stores a variable every reload, some server programmed system that stops you from reloading by deleting / not returning the reload script, ... In other words, not with the meta tag code posted in this answer.
    – Tabernero
    Commented Apr 19, 2018 at 21:20
  • 3
    Bonus points for detecting such a subtle error in the original question! Commented Mar 29, 2020 at 20:26
45

You're using smart quotes. That is, instead of standard quotation marks ("), you are using curly quotes (). This happens automatically with Microsoft Word and other word processors to make things look prettier, but it also mangles HTML. Make sure to code in a plain text editor, like Notepad or Notepad2.

<html>
  <head>
    <title>HTML in 10 Simple Steps or Less</title>
    <meta http-equiv="refresh" content="5"> <!-- See the difference? -->
  </head>
  <body>
  </body>
</html>
40

The quotes you use are the issue:

<meta http-equiv=”refresh” content=”5" >

You should use the "

<meta http-equiv="refresh" content="5">
27
<meta http-equiv="refresh" content="600; url=index.php">

600 is the amount of seconds between refresh cycles.

1
  • 2
    You should mention that automatic refresh can be disabled in some browsers
    – rene
    Commented Jan 3, 2012 at 12:11
15

Try this:

<meta http-equiv="refresh" content="5;URL= your url">

or

<meta http-equiv="refresh" content="5">  
0
8

Try this tag. This will refresh the index.html page every 30 seconds.

<meta http-equiv="refresh" content="30;url=index.html">

Not the answer you're looking for? Browse other questions tagged or ask your own question.