FULL SCREEN WINDOW代码在Chrome中运行,在Firefox中不运行 [英] FULL SCREEN WINDOW code working in Chrome, Not working in Firefox

查看:183
本文介绍了FULL SCREEN WINDOW代码在Chrome中运行,在Firefox中不运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经发布了全屏问题,并且找到了解决方案, 如何完成全屏窗口在Angular 2中单击按钮时是否具有功能?.

Already i have posted my question for full screen and i got the solution, How to do FULL SCREEN WINDOW functionality while clicking the button in Angular 2?.

该解决方案在 Chrome 浏览器上运行良好.但是,全屏窗口无法在 Firefox 浏览器

This solution is working fine for Chrome browser. But, Full screen window is not working In Firefox browsers

这是我的代码:

<button (click)="fullscreen()">Click</button>

fullscreen()
{
   let elem =  document.body; 
   let methodToBeInvoked = elem.requestFullscreen || 
   elem.webkitRequestFullScreen || elem['mozRequestFullscreen'] 
   || elem['msRequestFullscreen']; 

   if(methodToBeInvoked) methodToBeInvoked.call(elem);
}

我必须在此代码中为Firefox浏览器添加一些内容吗?

Do I have to add something in this code for Firefox browser?

在此先感谢:)

推荐答案

由于输入错误,它无法正常工作.将elem['mozRequestFullscreen']更改为elem['mozRequestFullScreen'],您会没事的.

It is not working because of typo. Change elem['mozRequestFullscreen'] to elem['mozRequestFullScreen'] and you 'll be fine.

您可以在此处找到工作版本.

You can find working version here.

这篇关于FULL SCREEN WINDOW代码在Chrome中运行,在Firefox中不运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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