Search code examples
angulartypescriptgoogle-chromeangular6

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


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);
    }