在移动Firefox中隐藏地址栏 [英] Hiding the address bar in mobile Firefox

查看:393
本文介绍了在移动Firefox中隐藏地址栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试了各种scrollTo()解决方案,这些解决方案在移动浏览器中隐藏了地址栏,但似乎在移动Firefox中都无法使用.

I have tried the various scrollTo() solutions which hide the address bar in a mobile browser, but none of them seem to work at all in mobile Firefox.

在这种情况下是否需要使用其他技巧?

Is there a different trick which needs to be used in that situation?

推荐答案

如果您负责编写要全屏显示的页面,则可以运行以下代码片段以使用API​​:

If you're in charge of writing the pages that you want fullscreen, you can run these littl bits of code to use the API:

function setFullScreen(el) {

    if (el.requestFullscreen) {
        el.requestFullscreen();
    } else if (el.msRequestFullscreen) {
        el.msRequestFullscreen();
    }else if (el.mozRequestFullScreen) {
        el.mozRequestFullScreen();
    }else if (el.webkitRequestFullscreen) {
        el.webkitRequestFullscreen();
    }
}

function exitFullScreen(){
    if (document.exitFullscreen) {
        document.exitFullscreen();
    } else if (document.msExitFullscreen) {
        document.msExitFullscreen();
    }else if (document.mozCancelFullScreen) {
        document.mozCancelFullScreen();
    }else if (document.webkitCancelFullScreen) {
        document.webkitCancelFullScreen();
    }
}

function toggleFullScreen(){
    if(!document.fullscreenElement && !document.msFullscreenElement && !document.mozFullScreenElement && !document.webkitFullscreenElement){
        setFullScreen(document.documentElement);
    }else{
        exitFullScreen();
    }
}

这篇关于在移动Firefox中隐藏地址栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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