On Thursday, November 10, 2011 10:03:19 AM UTC+1, Sanjay Jain wrote:
>
> I am using GWT 2.3 with GWTP plugin in my application.In this 
> application I want to block browser back and forth event.


Maybe you didn't choose the right platform for the job then. When 
developping a web app, your user can navigate at any time within your app 
(and not only to the "previous page", he can go back several pages back in 
time, and/or use a bookmark), he can "terminate" it at any time too (either 
by navigating away, or closing the tab/window, or reloading it). Embrace 
these facts, don't fight again them (I can guarantee that you and your 
users will lose); they are features of web apps, not constraints.
It's a real switch in paradigm from desktop apps, but a necessary one 
(fwiw, Android apps have similar behaviors to web apps too).

My first history token is index.So first my index page is loaded.Now 
> there is login panel on index page.After success full login I fire 
> another history token named userpage.So my user page is loaded.On back 
> click a history token index is fired again my index page loaded 
> again.And now If I click on forth of browser then again my user page 
> is loaded. 
>
> So for back I don't want to fire last history token again and same for 
> the forth not next history token. If history token would fired from 
> code instead of browser event (back and forth) then it should work in 
> proper manner.So just want to handle browser event. 
>
> For handling history I also overridden method on value change.So my 
> every history token is went to on Value change but I am not able to 
> identify, that the history token is fired is from browser event or 
> from code. 
>
> Please help me out. Thanks in advance.


Depending on your needs (is authentication mandatory to use the app?) and 
wants re. UX, I'd suggest, either:

   - do login outside the app, on a separate page (just like Google Apps); 
   so when the app is "started", either the user is authenticated, or it's not.
   - do not use a distinct history token for your login form; use events on 
   your eventbus instead (not navigation events).

Or simply give up on trying to fight this behavior and just live with it; 
is it a real issue for your app?

OK, technically, you could also replace the current URL when navigating 
to/from your login form; but GWT doesn't support it (not that it's 
impossible, just that it doesn't provide APIs to do it; Glosure Library for 
instance has what would be equivalent to a History.replaceToken() in 
addition to History.newItem()).

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/HJEC2HTgT-AJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to