public void onModuleLoad() { //disable refresh button Event.addNativePreviewHandler(new NativePreviewHandler() { public void onPreviewNativeEvent(NativePreviewEvent event) { switch (event.getTypeInt()) { case Event.ONKEYDOWN: NativeEvent nEvent = event.getNativeEvent(); if (nEvent.getCtrlKey() && nEvent.getKeyCode() == 'R') { nEvent.preventDefault(); } if (nEvent.getKeyCode() == 116) { nEvent.preventDefault(); } break; } } }); }This will full fill the need across the GWT application. Reference : Co worker : Ruhul
Monday, April 29, 2013
Prevent Default Refresh Event in Browser Using GWT
Bit odd requirement that if anyone need to prevent default Cntrl + R or F5 event using GWT (Google Web Tool Kit). It can be done easily.
In onModuleMethod of EntryPoint class just use this code.
Labels:
GWT
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment