如何让谷歌浏览器在 Angular 4 应用程序中全屏显示? [英] How to make google chrome go full screen in Angular 4 Application?

查看:25
本文介绍了如何让谷歌浏览器在 Angular 4 应用程序中全屏显示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个应用程序,我想实现这样的事情,如果用户离开一个组件 &进入其他组件,然后在其他组件的 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.

感谢任何帮助或参考.

推荐答案

你可以试试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 应用程序中全屏显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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