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.

Answers:

Answer

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.

Answer

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.

Answer

There isn't a way to resize the current window to full screen, but you can open a popup in full screen:

<script type="text/javascript">
<!--
function popup(url) 
{
 params  = 'width='+screen.width;
 params += ', height='+screen.height;
 params += ', top=0, left=0'
 params += ', fullscreen=yes';

 newwin=window.open(url,'windowname4', params);
 if (window.focus) {newwin.focus()}
 return false;
}
// -->
</script>

<a href="javascript: void(0)" 
   onclick="popup('popup.html')">Fullscreen popup window</a>
Answer

Open a new window in full screen mode on IE:

<script>
<!--
window.open("page.html","fs","fullscreen,scrollbars")
//-->
</script> 

Putting in a "Close" link on page.html may be a good idea:

<a href="#" onclick="window.close()">Close Window</a>
Answer

In the past, I've seen websites do this. However, as it's incredibly annoying and generally used by ads for pr0n websites, the technique may be blocked in recent browsers.

But I think the important point is: it's incredibly annoying and generally used by ads for pr0n websites, so you probably don't want to associate yourself which such things, so your probably best off just asking your users to maximize their browsers.

Answer

To modify the parent window, try something like:

window.opener.location.href = '/confirmation/page.html';
Answer

F11 takes IE and Firefox into fullscreen mode. I'm sure it's possible to go fullscreen, since YouTube and other video streaming sites can do it with Flash, but I don't know how with javascript.

Answer

This feature is more interesting for mobile browsers, which support fullscreen. The most mobile browser wont have an option for fullscreen by tap an option. You have a change to switch to fullscreen to get a little bit app feeling.

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.