2

I was wondering, can we trigger any key press even in GWT without JSNI? For example, say I have a image or a button in the header of my application. On click of it I want to go fullscreen on browser which simulates F11 key press. Again on click of the same image or button I want to exit from the full screen mode which simulates ESC key press.

I came to know through " How to make browser full screen using F11 key event through JavaScript " that we can do via java script, so it must be possible to do that via JSNI code snippet. Is there any other solution possible which doesn't use JSNI code?

Community
  • 1
  • 1
Abhijith Nagaraja
  • 3,370
  • 6
  • 27
  • 55

1 Answers1

0

You would need to use Document.get().createKeyEvent or similar api.

NativeEvent event = Document.get().createKeyEvent(args.....);

DomEvent.fireNativeEvent(event, this);

Check which apis are deprecated before use.

jusio
  • 9,850
  • 1
  • 42
  • 57
appbootup
  • 9,537
  • 3
  • 33
  • 65