Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could a website force the browser to go into fullscreen mode?

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

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?

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.

like image 501
ypnos Avatar asked Oct 23 '08 02:10

ypnos


2 Answers

You could just tell the user to press F11. Next to it, put a 'why?' link and explain why you feel like they need to be in fullscreen mode.

I don't think you can force a browser to go full screen and, in fact, if you were able to do that I'd be furious at my browser. It's too invasive. Even Flash has security so that forcing the plugin to go to fullscreen requires the event to originate with a user interaction. So, if it's that important to you, this might be a good reason to use the Flash plugin because you could attach the go-fullscreen call to a misleading button that says 'start quiz' (or whatever).

But, please don't do that. Just be straight forward with the user and tell them to hit F11.

EDIT: I just tried the sample code provided in another comment and I'm happy to say that Firefox opens up a maximized window with an address bar, not a fullscreen window.

like image 176
mqsoh Avatar answered Sep 28 '22 00:09

mqsoh


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

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.

like image 41
Swen Avatar answered Sep 28 '22 01:09

Swen