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);
精彩评论