使用元标记自动刷新 HTML 中的代码

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8711888/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 12:18:53  来源:igfitidea点击:

Auto refresh code in HTML using meta tags

htmlmeta

提问by Sourabh

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

我正在尝试刷新同一页面,但它不起作用。这是我的 HTML 代码:

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

    </body>
</html>

回答by Dennis Traub

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:

看起来您可能使用一种浏览器无法识别的双引号粘贴了这个(或使用了像 MS Word 这样的文字处理器)。请检查您的代码是否使用了像这样的实际双引号",它与以下字符不同:

Replace the meta tag with this one and try again:

用这个替换元标记并重试:

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

回答by benesch

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.

您正在使用智能引号。也就是说",您使用的是大引号 ( )而不是标准引号 ( )。Microsoft Word 和其他文字处理器会自动发生这种情况,以使事情看起来更漂亮,但它也会破坏 HTML。确保在纯文本编辑器中进行编码,例如 Notepad 或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>

回答by Book Of Zeus

The quotes you use are the issue:

您使用的引号是问题:

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

You should use the "

你应该使用 "

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

回答by Wazy

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

600 is the amount of seconds between refresh cycles.

600 是刷新周期之间的秒数。

回答by Mr.G

Try this:

尝试这个:

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

or

或者

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

回答by Mr.G

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

试试这个标签。这将index.html每 30 秒刷新一次页面。

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