Well, in fact you don't "disable" the buttons.
In the disableFunctionKey.js file, the function just intercept the
keydown or keypress
and return a value tha is not the expected by the browser.

As I wrote, maybe you can find a solution that intercept the browser
back button click.

On 7 jan, 12:13, Anita <[email protected]> wrote:
> Hi  Rogério Valente,
>
> Thanks for the reply.
> If i disable the buttons how will i come to know that the back button
> is clicked ?
>
> On Jan 7, 7:00 pm, Rogério Valente <[email protected]> wrote:
>
> > I don't know if this can help you but, we just add a script in
> > <appName>.html to disable some functions key (F5 to refresh).
> > Take a look at the code below. Put it in a javascript file in
> > <appName>/war/js and add a script tag on the head section of your app
> > main html file ..
> > something like <script type="text/javascript" language="javascript"
> > src="js/disableFunctionKey.js"></script>
>
> > Maybe you can find a solution to disable the buttons.
>
> > [CODE]
>
> >             //Disable F5 - Refresh
> >     var isIE = ( navigator.userAgent.toLowerCase().indexOf("msie") !=
> > -1 );
> >     function interceptKeyDown(e) {
> >         keyCode = e.keyCode;
> >         //F5
> >         if ( keyCode == 116 ) {
> >             if(isIE) {
> >                // IE only
> >                e.keyCode = 505;
> >             }
> >             return false;
> >         }
> >     }
> >     function interceptKeyPress(e) {
> >         if( !e ) {
> >             if (window.event)
> >                e = window.event;
> >             else
> >                return;
> >         }
> >         //NS 4, NS 6+, Mozilla 0.9+, Opera
> >         if(typeof(e.which) == 'number') {
> >             var keyCode = e.keyCode ? e.keyCode : e.which ? e.which :
> > void 0;
> >             if(e.charCode == null || e.charCode == 0 ) {
> >                // F5
> >                if ( keyCode == 116 ) {
> >                    e.stopPropagation();
> >                    e.preventDefault();
> >                }
> >             }
> >          }
> >     }
> >     function attachEventListener( obj, type, func, capture ) {
> >         if(window.addEventListener) {
> >             //Mozilla, Netscape, Firefox
> >             obj.addEventListener( type, func, capture );
> >         } else {
> >             //IE
> >             obj.attachEvent( 'on' + type, func );
> >         }
> >     }
>
> >     attachEventListener(document,"keydown",interceptKeyDown,true);
> >     attachEventListener(document,"keypress",interceptKeyPress,true);
>
> > [END-CODE]
>
> > On 7 jan, 10:34, Anita <[email protected]> wrote:
>
> > > Hi,
>
> > > How can I detect on GWT client side that browser's back or forward
> > > button is clicked? Because on click of back and forward button i want
> > > to perform custom operation.
>
> > > Thank You.
-- 
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].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.


Reply via email to