...

View Full Version : control REFRESH?



king2k5
04-29-2006, 04:36 PM
Is this possible...

IF(USER HITS REFRESH){
SEND TO THIS PAGE
}ELSE{
DONT
}

If this is possible, please let me know what really to use :P

king2k5
04-29-2006, 07:47 PM
If i only knew the javascript command to refresh, like when you hit a link it refreshes.. thats pretty simple i think... can someone tell me that?

Nightfire
04-30-2006, 06:01 AM
Not in php and doubt you could in javascript. If you could in javascript, then it'll be easy to get around anyways, so there's no point

ralph l mayo
04-30-2006, 08:31 PM
Seems to work in firefox:



<span onclick="window.location.href = window.location.href">refresh</span>

missing-score
05-01-2006, 02:16 AM
or you can usually use window.reload();

But IMO, a better choice if you want a good coverage and want to see if the user pressed refresh in their browser would be to use a PHP session to log if they have visited the page. This should work in 99.9% of cases:

This needs to be at the very top of your script



<?php

session_start();

if( isset( $_SESSION['page-viewed'] ) && $_SESSION['page-viewed'] == true )
{
header( 'Location: http://www.yoursite.com/newurl' );
die;
}

$_SESSION['page-viewed'] = true;

?>
<!DOCTYPE...>
<html>
<head>
<title>Your Page</title>
</head>
<body>
<p>What you want the user to see the first time they visit the page</p>
</body>
</html>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum