Ever want to prevent your users from logging themselves out or refreshing their session by pressing CMD/CTRL-R ? The Xojo Web Framework has an exposed javascript command for doing that. In Session.Opening, try this:
Self.ExecuteJavaScript("XojoWeb.overrideMetaKey('r');")
Now if you run your project and press CTRL/CMD-R, the framework will capture the event and not let it go to the browser!
For those WebSDK devs out there, the parameters are:
- key as string (key to intercept, notice I used lowercase r. if you use R, you’re capturing CMD-SHIFT-R)
- targetElement as HTMLElement ( where the event listener is attached, defaults to
document
) - callback method (method that you want to be called when the command key is pressed. defaults to
null
. it looks like the callback method needs to take two parameters, the second appears to be the key name)