Meta Tag Refresh Page

liunx

Guest
I have allready posted this but noone took any notice.<br />
<br />
I want a meta tag that i can put in an html document that will refresh the page it is on once without specifying an url.<br />
<br />
whenever i don't specify an url it just refreshes over and over again which is obviously not what i want...<br />
<br />
Can anyone help?<br />
<br />
Spyke.<!--content-->A meta tag on its own cannot do this, because it simply causes a page refresh after x seconds. You need to add code either on the client or server-side which tests if this is the first or second display of the page.<br />
<br />
You can do this client-side with Javascript, but a server-side script (using a language such as PHP) would be much more reliable.<br />
<br />
PHP solution (add this where you would add the meta tag, untested):<br />
<?php if (!isset($_GET['reloaded'])) echo '<meta http-equiv="refresh" content="10; URL=filename.php?reloaded=true;">'; ?><br />
<br />
Javascript solution (ditto):<br />
<script type="text/javascript"><br />
if (location.search != '?reloaded=true'){<br />
setTimeout('window.location = "filename.html?reloaded = true"', 10 * 1000);<br />
}<br />
</script><!--content-->Oh, I see.... Thankyou for that!<!--content-->still have to specify an url though...<!--content-->Sorry, I misinterpreted your post. Perhaps one of these might work?<br />
<br />
<?php if (!isset($_GET['reloaded'])) echo '<meta http-equiv="refresh" content="10; URL=' . __FILE__ . '?reloaded=true;">'; ?><br />
<br />
<script type="text/javascript"><br />
if (location.search != '?reloaded=true'){<br />
setTimeout('window.location = window.location + "?reloaded = true"', 10 * 1000);<br />
}<br />
</script><br />
<br />
Adam<!--content-->
 
Back
Top