Welcome Guest, Not a member yet? Register   Sign In
How can you force a Page reload?
#1

[eluser]Nuu[/eluser]
I am writing a game app where you need to move from one location to another. Each location is represented by an ID.

For example:

ID Location
1 Town
2 Cave
3 Lava Pit
4 Boss Lair

So i have coded a Move controller that will move the player from location to location i.e. //localhost/move/index/2 would move the player to Cave where as //localhost/move/index/3 will move him to the Lava Pit. I also want it done in such a way where you can only go to the Lava Pit from the Cave and not from Town.

Let's say he has successfully moved from Town to Cave to Lava Pit. At this point, he can enter the URL //localhost/move/index/1 and ended up in town. The browser will display the town page since it has been cached. How can I prevent this from happening. Is there a way to force the browser to reload the page instead of using the cached version? That way I can force an validation to ensure the move is possible and reject it is no longer reachable.

In addition, is there a way to force a page reload when the user clicks the BACK button?

Thanks.
#2

[eluser]Berserk[/eluser]
example:

redirect('town/'.$townId);
#3

[eluser]murtuza54[/eluser]
make one library 'redirection'
then make one function 'target' in redirection

target function will have argument as the new URL

then simply redirect to that url in that target function with redirect function

then using back button page will refresh.
and if data was posted then also it wont hav any problem like repost..

Enjoy
#4

[eluser]murtuza54[/eluser]
i meant to change URL or redirect
use target function of library made as above indicated
#5

[eluser]TheFuzzy0ne[/eluser]
Two methods I can think of.

First is a meta tag: <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">

That's not always reliable, however, as some browsers ignore it.

Another method is to add a the output from time() to the end of the URL. If the URL is unique every time, the cached files will never be called. You'd no doubt need to do a redirect every time, however.




Theme © iAndrew 2016 - Forum software by © MyBB