I'm developing a website using php. Now my question is, Is there a way to redirect to signin page, if the user deletes browser history. I have searched. But didn't found any way.
Regards, Sasi
I'm developing a website using php. Now my question is, Is there a way to redirect to signin page, if the user deletes browser history. I have searched. But didn't found any way.
Regards, Sasi
You cannot do that because it is not possible / not allowed to access browser history … there may be some ways but accessing the users browser history is definitely a hit on privacy and most likely illegal in most countries.
Whatever you want to achieve there are better and more robust solutions for that than "stealing" your users history. For example Cookies, Local/Session Storage or PHP Sessions.
As requested a sample … This is not exactly what you want (which is not possible because you can't access history) but maybe an alternative:
session_start();
$check = time() - 300; // 5 Minutes
if( !isset( $_SESSION[ 'login' ] ) OR $_SESSION[ 'login' ] > $check ):
header( 'Location: ./login.php' );
exit;
endif;
$_SESSION[ 'login' ] = time();
This should be placed on every page (except login) as first code. It sets/refreshes on every load a timestamp in a session variable. Before that it checks if the variable exists or if the time difference is to big (5 minutes). If not it redirects.
Not tested … just to give you an idea.