fullscreen through javascript

前端 未结 1 1590
悲哀的现实
悲哀的现实 2021-01-22 08:31

well making a page fullscreen is one of my favorite topics but whenever I have thought of doing it, I have always received one answer and that is, it is only done with flash. Fo

1条回答
  •  执念已碎
    2021-01-22 09:10

    Some browser support this through html5.

    Try

    var docElm = document.documentElement;
    if (docElm.requestFullscreen) {
        docElm.requestFullscreen();
    }
    else if (docElm.mozRequestFullScreen) {
        docElm.mozRequestFullScreen();
    }
    else if (docElm.webkitRequestFullScreen) {
        docElm.webkitRequestFullScreen();
    }
    

    0 讨论(0)
提交回复
热议问题