开发者

How Can I mimic a meta refresh with JS?

I tried to do

<script type="text/java开发者_开发百科script"> //<![CDATA[ document.write('<meta http-equiv="refresh" content="0;url=index.php" />'); //]]> </script>

but that doesn't validate on strict =[

how can I do that with JS alone?


How about:

location.href = 'index.php';

To refresh the same page:

location.reload();

To wait 2 seconds before reloading (as <meta> can do):

setTimeout(function(){ location.reload(); }, 2000);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜