[SOLVED] How to make google chrome go full screen in Angular 4 Application?

Issue

I am developing an application where I want to implement such a thing where if user leaves from one component & enters other component, then in other component’s ngOnInit method chrome browser should go full screen same as when we press Fn + F11 Key.

Any help or references are appreciated.

Solution

You can try with requestFullscreen

I have create a demo on Stackblitz

fullScreen() {
    let elem = document.documentElement;
    let methodToBeInvoked = elem.requestFullscreen ||
      elem.webkitRequestFullScreen || elem['mozRequestFullscreen']
      ||
      elem['msRequestFullscreen'];
    if (methodToBeInvoked) methodToBeInvoked.call(elem);
}

Answered By – Krishna Rathore

Answer Checked By – Marie Seifert (BugsFixing Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *