FULL SCREEN WINDOW code working in Chrome, Not working in Firefox

拜拜、爱过 提交于 2019-12-08 12:52:27

问题


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?.

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

Here is my code:

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

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

Thanks in Advance :)


回答1:


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

You can find working version here.



来源:https://stackoverflow.com/questions/51834858/full-screen-window-code-working-in-chrome-not-working-in-firefox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!