Re: How can I prevent from reloading the page when the reload button on browser is clicked?
Everyone is of course correct about not trying to circumvent reload/
refresh, and using history tokens to track the current document and
any state. If your app displays one or a few "documents" like emails,
and has an easily enumerable set of display configurations, this works
great.
Just wanted to mention that there is a class of apps where this is not
an option, because the state is too complicated to capture in url
tokens and it is impractical to send the complete state back to the
server for permanent storage/unique token generation every time it
changes. In these cases, you can still store the state locally, to
make history work, but maybe have a "Link" button ala google maps for
when someone wants to permanently store a particular view to send to
someone. Unfortunately this won't survive refresh or pasting the link
into another browser unless the user creates the permalink, in which
case you might weigh if you should bother the user with some sort of
Save dialog as mentioned above.
On Jun 1, 8:03 am, Ranjan <ranjan.n...@gmail.com> wrote:
> Simply put, it is impossible to avoid Page reload if the User clicks
> the 'Refresh' button on the browser. There is no way to avoid it if
> the user wants to refresh the page.
>
> And yes, when the page is refreshed, every object contained within the
> Page is lost. So you will have to create the whole page from the
> scratch.
>
> Now the problem you are facing (as I have understood) is, as the user
> works on your application, a number of widgets are created, removed,
> moved from one place to another, so on. And if at any point, the user
> Refreshes the page, your page would start up with the initial
> condition.
>
> This is normally solved by using history tokens. Now when I say saving
> a state, I meant saving it in a small piece of string, that would be a
> part of the URL (Something like #page/10caf10b or #navigation/91abc,
> etc). Now this small bits of information are usually sufficient for
> loading the entire page. It might make few ajax calls with the server.
> Sessions are used in cases like this.
>
> And believe me a very complex applications could be developed using
> just small bits of tokens that can easily be accommodated in the URL
> itself. Take GMail for example. You can just browse through different
> states of the Gmail application, and if you press refresh button at
> any state, you will get the same page when it refreshes.
>
> I hope you got my point.
>
> Page reloading is something that is done by the User and it can't be
> avoided. Its up to the programmer that the user receives the same
> interface even if he/she refreshes the page at any state of the
> application.
>
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home