manuolive Posted December 6, 2007 Share Posted December 6, 2007 Hi Dudes, I have a query regarding browser url.Let me narrate the exact scenario which i need. I would like to expire my session when a person enters different url in the navigator bar other than my url and comes back to my url. For example if i visit example.com and then i type gmail in the same navigator bar and then move back to my url example.com through browser back button then i have to end the session of my client i mean he has no more access to my site. The same scenario is there for icicibank.com. I wanna the code using php and javascript. Please help me. Its urgent. Expecting the favor. Thank you Quote Link to comment https://forums.phpfreaks.com/topic/80409-how-to-read-previous-url-when-back-button-is-pressed-on-browser/ Share on other sites More sharing options...
~n[EO]n~ Posted December 6, 2007 Share Posted December 6, 2007 Similar Thread http://www.phpfreaks.com/forums/index.php/topic,170476.0.html Quote Link to comment https://forums.phpfreaks.com/topic/80409-how-to-read-previous-url-when-back-button-is-pressed-on-browser/#findComment-407694 Share on other sites More sharing options...
kishan Posted December 6, 2007 Share Posted December 6, 2007 use $_SERVER['HTTP_REFERER'] in ur home page and check whether it matches with ur url or not if not expire the session.. Quote Link to comment https://forums.phpfreaks.com/topic/80409-how-to-read-previous-url-when-back-button-is-pressed-on-browser/#findComment-407809 Share on other sites More sharing options...
manuolive Posted December 6, 2007 Author Share Posted December 6, 2007 use $_SERVER['HTTP_REFERER'] in ur home page and check whether it matches with ur url or not if not expire the session.. we have tried $_SERVER['HTTP_REFERER'] but when we navigate from our site to other site the referer is not getting changed it is having our site last actioned page url. Please suggest me any other way. Quote Link to comment https://forums.phpfreaks.com/topic/80409-how-to-read-previous-url-when-back-button-is-pressed-on-browser/#findComment-407812 Share on other sites More sharing options...
kishan Posted December 6, 2007 Share Posted December 6, 2007 or do 1thing try to capture the windows event i.e back button in javascript like onmousedown then if its a back button like event.keyCode then try to navigate to a diff page and kill the session. Quote Link to comment https://forums.phpfreaks.com/topic/80409-how-to-read-previous-url-when-back-button-is-pressed-on-browser/#findComment-407829 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.