I am new to development, I wanna know is there method to call/trigger key event using any frontend programs.
Asked
Active
Viewed 211 times
-9
-
5Client-side javascript cannot control the browser in this way. This is a security issue. – simonzack Feb 18 '14 at 07:44
-
If you want fullscreen, ask for that (or search for questions asking that; it's been asked before), don't bother with the very roundabout fact that a non-javascript solution would be to press a certain key on the keyboard. – David Hedlund Feb 18 '14 at 07:45
-
I don't think that can't be done. Do check the answers that have already been asked before. Cheers. – rockinfresh Feb 18 '14 at 07:48
-
Actually, I want it for another purpose my aim here is to access keyboard – Mahendra Jella Feb 18 '14 at 07:54
-
why you are giving down voting, I am asking for suggestions to access a keyboard. @All down voters – Mahendra Jella Feb 18 '14 at 08:00
2 Answers
1
You can full screen the browser directly using below code
var docElement, request;
docElement = document.documentElement;
request = docElement.requestFullScreen || docElement.webkitRequestFullScreen ||
docElement.mozRequestFullScreen || docElement.msRequestFullScreen;
if(typeof request!="undefined" && request){
request.call(docElement);
}

Manoj
- 56
- 3
-3
//These method use to request full screen
var docElm = document.documentElement;
if (docElm.requestFullscreen) {
docElm.requestFullscreen();
}
else if (docElm.mozRequestFullScreen) {
docElm.mozRequestFullScreen();
}
else if (docElm.webkitRequestFullScreen) {
docElm.webkitRequestFullScreen();
}
//Exit the full screen
if (document.exitFullscreen) {
document.exitFullscreen();
}
else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
}
else if (document.webkitCancelFullScreen) {
document.webkitCancelFullScreen();
}
Other way using Screenfull.js http://www.paulund.co.uk/javascript-full-screen-api

Mohit Gupta
- 727
- 2
- 7
- 21