Page 1 of 1

Any way to detect a back or refresh?

Posted: Sun Oct 22, 2006 6:00 pm
by Citizen
I've searched for about 30 mins and cant find anything on it.

I'm making a web based game and was wondering if there was a way to detect if a user clicks back or refresh in a browser.

Any ideas?

Thanks.

Posted: Sun Oct 22, 2006 6:02 pm
by Z3RO21
on a page check to see if the session var $_SESSION['MySessionVar'] exists and if it doesn't set it and if it does exist then they have either refreshed or navigated back to the page

Posted: Sun Oct 22, 2006 6:04 pm
by Citizen
I want them to be able to visit the page more than once, but only if they use the navigation system and not browser controls.

Posted: Sun Oct 22, 2006 7:08 pm
by Cameri
You could use AJAX, and instead of loading a new page, just retrieve the content the user requests, that way the back button is useless

Posted: Mon Oct 23, 2006 3:35 am
by onion2k
Cameri wrote:You could use AJAX, and instead of loading a new page, just retrieve the content the user requests, that way the back button is useless
If you're doing AJAX properly then the back button should still work.

Posted: Mon Oct 23, 2006 11:24 am
by Cameri
If you use the AJAX tecnique with iframes, then you can still use the back buttons, but if you use the XmlHttp object, then you shouldnt be able to go back unless you REALLY came from another page.

Posted: Tue Oct 24, 2006 3:31 am
by onion2k
Cameri wrote:If you use the AJAX tecnique with iframes, then you can still use the back buttons, but if you use the XmlHttp object, then you shouldnt be able to go back unless you REALLY came from another page.
Nope. If you use an XmlHttp request you should still be able to use the back button. It's a fundamental aspect of accessibility. http://www.onjava.com/pub/a/onjava/2005 ... utton.html