简体   繁体   中英

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" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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