【问题标题】:Meta Tag refresh not working in chrome元标记刷新在 chrome 中不起作用
【发布时间】:2012-06-30 21:00:15
【问题描述】:

以下是我的代码 .. 在 IE 和 Firefox 中它运行良好 .. 即 10 秒后它被重定向到 www.google.com .. 但相同的代码在 Chrome 中不起作用

<html>  
<head>
<title>App- Log In</title>

<meta http-equiv="refresh" content="10; url=http://www.google.com">

<script language="JavaScript">
      function noBack(){window.history.forward()}
      noBack();
      window.onload=noBack;
      window.onpageshow=function(evt){if(evt.persisted)noBack()}
      window.onunload=function(){void(0)}
</script>   

</head>

  <body>
Testing
</body>
</html>

【问题讨论】:

  • 不确定这个..但是您是否尝试删除 10 之间的空格;和 url=http://...?
  • &lt;html style="display: block; "&gt; 不是有效的 HTML 代码
  • 删除了该样式。 ..即使是同样的问题
  • 服务器是否发送了实际的Refresh HTTP 标头?这应该覆盖第一页中的内容。
  • 您能解释一下第一个script 标签中发生了什么吗?我不明白。是否可以防止使用浏览器历史记录返回?

标签: javascript html google-chrome cross-browser


【解决方案1】:

你的问题是这一行:

window.history.forward()

只要执行了这一行,就会在 Chrome 中禁用元刷新。

我的建议是不要尝试禁用后退按钮,因为它不能可靠地工作,并且从我收集到的 it can't be done.

【讨论】:

  • Correct Per ...
猜你喜欢
  • 2012-06-01
  • 2012-08-08
  • 2010-10-06
  • 1970-01-01
  • 2017-05-02
  • 2018-06-19
  • 2016-05-15
  • 2014-11-19
  • 1970-01-01
相关资源
最近更新 更多