当前位置: 动力学知识库 > 问答 > 编程问答 >

php - Meta refresh won't refresh

问题描述:

Is it required to have your meta refresh line to be above your </head> line? In my case, I can't because I would have to parse a few variables to dictation the # of seconds for the page to auto refresh. All this happens in the middle of my page and I also place this tag in the middle as well. My success rate has been pretty good, but sometimes it would not refresh at all.

Is there any other refreshing code that I can use that would guarantee a successful rate 100% of the time?

The tag I'm using here is:

<meta http-equiv="refresh" content="<?=$now['rsecs'];?>" url="&session<?=rand(1,999999999999)?>">

网友答案:

Your syntax is wrong:

<meta http-equiv="refresh" content="<?php echo $now['rsecs'];?>;URL='&session=<?php echo rand(1,999999999999);?>'">

I am not sure that just adding &session to the url path will send you to the right location. Perhaps include the full url?

URL='http://www.your-site.com/page.html?othervars=othervals&session=<?php echo rand(1,999999999999);?>
网友答案:

See this url:-

http://davidwalsh.name/automatically-refresh-page-javascript-meta-tags

http://www.techtricky.com/how-to-refresh-page-or-part-of-the-page-automatically/

Try this

The JavaScript Method

var timer = null;
function auto_reload()
{
  window.location = 'http://domain.com/page.php';
}

 <body onload="timer = setTimeout('auto_reload()',10000);">

OR

The META Tag Method

The following refreshes the page every 30 seconds.

<head>
<meta http-equiv="refresh" content="30" />
</head>

or

<meta http-equiv="refresh" content="0;http://www.example.com" />

Or

<meta http-equiv="refresh" content="0;URL=http://www.example.com" />

Or

<meta http-equiv="refresh" content="30;URL=http://intranet/page.asp?x=123" />
分享给朋友:
您可能感兴趣的文章:
随机阅读: