If you are dealing with newer browser versions, the code provided below will assist you in achieving full-screen functionality after clicking a button within your application. The submitLogin() function is triggered upon button click and handles the login process based on the user input.
submitLogin() {
this.toggleFullScreen();
if(this.userName == "Student" && this.passWord == "student@123"){
this.dashboard = true;
}
else{
alert("Incorrect Username or Password");
}
}
toggleFullScreen() {
let elem = document.body;
let methodToBeInvoked = elem.requestFullscreen ||
elem.webkitRequestFullScreen || elem['mozRequestFullscreen'] ||
elem['msRequestFullscreen'];
if(methodToBeInvoked) methodToBeInvoked.call(elem);
}
To explore further information on working with full-screen mode, you can visit the following link to the documentation.
Update: It should be noted that ActiveXObject is only supported by Internet Explorer browsers and may cause errors in other user agents. Below is an alternative code snippet for handling full-screen functionality:
toggleFullScreen() {
let elem = document.body;
let methodToBeInvoked = elem.requestFullscreen ||
elem.webkitRequestFullScreen || elem['mozRequestFullscreen']
||
elem['msRequestFullscreen'];
if(methodToBeInvoked) methodToBeInvoked.call(elem);
}