如何使Angular 4 Application中的Google Chrome进入全屏显示? [英] How to make google chrome go full screen in Angular 4 Application?

查看:143
本文介绍了如何使Angular 4 Application中的Google Chrome进入全屏显示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个应用程序,如果用户离开一个组件,我想实现这样的事情.输入其他组件,然后在其他组件的ngOnInit方法中,Chrome浏览器应全屏显示,与我们按Fn + F11键时一样.

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.

推荐答案

您可以尝试使用requestFullscreen

我已经在 Stackblitz

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

这篇关于如何使Angular 4 Application中的Google Chrome进入全屏显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆