Hi Thomas,

Thanks for your response.

I am not using MVP .I am not using  PlaceController . So I only relay on 
 History.addValueChangeHandler. 

What problem I am facing is ...

In GWT have History ,HistoryImpl classes. 

HistoryImpl class have newItem() , newItemOnEvent() these two  final 
methods will change the $wnd.location.hash value when we click on browser 
back button.

Moreover, GWT have different HistoryImpl   classes for browser specific 
 and  contain native methods to update the $wnd.location.hash .
Like under package com.google.gwt.user.client.impl

HistoryImpl
HistoryImplIE6
HistoryImplMozilla
HistoryImplSafari
HistoryImplTimer


*For Example :* In Mozilla browser , if I click on browser back 
button,control is going to  HistoryImplMozilla (see below GWT 
implementation in History.gwt.xml) and change the the browser URL in 
"nativeUpdate" method  and then control will come to   
History.addValueChangeHandler (onValueChange())   at this time the browser 
URL already modified and difficult to get the original URL from here.

History.gwt.xml

  <!-- Mozilla has a slightly different history implementation than the     
-->
  <!-- standard case.                                                       
-->
  <replace-with class="com.google.gwt.user.client.impl.HistoryImplMozilla">
    <when-type-is class="com.google.gwt.user.client.impl.HistoryImpl"/>
    <any>
<when-property-is name="user.agent" value="gecko1_8"/>
<when-property-is name="user.agent" value="gecko"/>
</any>
  </replace-with>

How to show the alert message  in this time ? in Alert message if user 
clicks to NO button means wants to stay in same page then its difficult to 
get the original URL . because original URL already modified.

In which place is suitable for showing Alert message to the user  if form 
is dirty and clicks on browser back button.

Its difficult to customize the HistoryImpl class for newItem() , 
newItemOnEvent() these are final methods can't over ride in sub classes. If 
i do that (copy entire class and done the customize) I need to customize 
History ,HistoryImpl ,HistoryImplIE6,HistoryImplMozilla , HistoryImplSafari 
,HistoryImplTimer.

Can you please suggest the best way to handle this problem ?

Thanks










On Tuesday, January 22, 2013 2:56:17 PM UTC+5:30, Thomas Broyer wrote:
>
>
>
> On Monday, January 21, 2013 6:31:12 PM UTC+1, Darsha Sai wrote:
>>
>> Hi ,
>>
>> I want to display alert message when user click on browser back 
>> button/forward button/refresh buttons if form is dirty.
>>
>> How to capture  browser back button/forward button in gwt ?
>>
>
> You can't. You can only react to navigation, either within the app 
> (History.addValueChangeHandler) or out of the app 
> (Window.addWindowClosingHandler).
> There are APIs that wrap them both though: adding a 
> PlaceChangeRequestEvent.Handler to the eventbus if you use the 
> PlaceController, or implementing mayStop() in your activity if you use 
> activities.
>

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


Reply via email to