简体   繁体   English

Javascript +元刷新不断重新加载

[英]Javascript + meta refresh keeps reloading

I have below code.But this keeps on reloading the page instead of redirecting. 我有下面的代码。但这会继续重新加载页面而不是重定向。

    <script>
function my()
        {
          document.write("<meta content='0;url=http://google.com' http-equiv='refresh'></meta>");
        }
      </script>
      <center> <input name='image' onclick='my();' src='http://i.imgur.com/jgI5Ryt.png' type='image'/></center>

Note : i need meta refresh for some reason.So please help me with above code only. 注意:由于某些原因我需要元刷新。所以请仅通过以上代码帮助我。

You can achieve it by replacing 您可以通过替换来实现

document.write("<meta content='0;url=http://google.com' http-equiv='refresh'></meta>");

with

$('head').append('<meta content='0;url=http://google.com' http-equiv='refresh'></meta>');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM