可能网站强制浏览器进入全屏模式? [英] Could a website force the browser to go into fullscreen mode?

查看:217
本文介绍了可能网站强制浏览器进入全屏模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想运行一个心理研究的参与者都看大量的图片。

I want to run a psychological study for which participants have to look at large images.

该实验是在网络上,因此在浏览器窗口中完成。是否可以告诉浏览器进入全屏,例如按钮preSS?

The experiment is done on the web and therefore in a browser window. Is it possible to tell the browser to go into fullscreen, for example on button press?

我知道有打开一个固定大小的弹出窗口的可能性。你是否认为这将是一个feasable替代?如果,什么是做到这一点的最好方法是什么?是否有检测一个弹出窗口阻止程序优雅的方式,以后备和运行在原来的浏览器窗口的研究。

I know there is the possibility to open a fixed-size popup window. Do you think this would be a feasable alternative? And if, what would be the best way to do it? Are there elegant ways of detecting a popup-blocker, to fallback and run the study in the original browser window.

主要关注的是,这项研究的参与者不熟悉的技术细节,不应该由他们来打扰。

The main concern is that the participants of this study are not familiar with technical details and should not be bothered by them.

推荐答案

我已经发现了一些code搜索后。

I have found some code after searching.

function fullscreen() {
    var element = document.getElementById("content");
    if (element.requestFullScreen) {
        if (!document.fullScreen) {
            element.requestFullscreen();
            $(".fullscreen").attr('src',"img/icons/panel_resize_actual.png");
        } else {
            document.exitFullScreen();
            $(".fullscreen").attr('src',"img/icons/panel_resize.png");
        }

    } else if (element.mozRequestFullScreen) {

        if (!document.mozFullScreen) {
            element.mozRequestFullScreen();
            $(".fullscreen").attr('src',"img/icons/panel_resize_actual.png");
            google.maps.event.trigger(map, 'resize');
        } else {
            document.mozCancelFullScreen();
            $(".fullscreen").attr('src',"img/icons/panel_resize.png");
        }

    } else if (element.webkitRequestFullScreen) {

        if (!document.webkitIsFullScreen) {
            element.webkitRequestFullScreen();
            $(".fullscreen").attr('src',"img/icons/panel_resize_actual.png");
            google.maps.event.trigger(map, 'resize');
        } else {
            document.webkitCancelFullScreen();
            $(".fullscreen").attr('src',"img/icons/panel_resize.png");
        } 
    } 
}

这将使用HTML5 API。我与jQuery切换一个特殊的画面吧。希望将助阵。此刻,我不知道你是否能强迫它,'造成它forbitten由于安全性。

It will use html5 api. I switch with jquery the a special picture for it. Hope that will help out. At the moment, i don't know if you can force it, 'cause it was forbitten due security.

这篇关于可能网站强制浏览器进入全屏模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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