Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

How to turn the white border into black when fullscreen in browser

edited May 2023 in OSWeb

Hello everyone,

In my experiment, I want participants to press F11 to fullscreen the browser before they start my experiment. However, the outside area will be white (see my screenshot) when I test it. Does anyone know how to turn that white border into black? My OpenSesame version is 3.3.14 and OSWeb is 1.4.13.1.

Thanks ahead.

(click the picture and you will see the white border)

Comments

  • Hi @Siyang,

    One solution would be to chage the resolution of your experiment to match your screen's resolution. n my case, my screen is set to 4K, so the following settings will make the whole screen black after I press F11 in the browser:

    However, this solution is not entirely satisfactory because it means you may have to scale up all of your stimuli pictures, your text etc. so that it doesn't look too small. Also, it would mean having to do so again if you then decided to run the experiment on another computer using another resolution. Third, if you're planning to run this online, this is not suitable because you can't know what screen reolution the participants will have.

    Hence, I'd recommend an alternative using some Javascript coding:

    When running an experiment in the browser, you can use Javascript to modify aspects of the HTML document. While I don't think you can get rid of the white present on the very initial page (OSWeb's welcome screen), you can for everything else that follows.

    All you need to do is to insert the following Javascript in an inline_javascript at the beginning of the experiment:

    document.body.style.backgroundColor = 'black';
    

    That will change the background color of the HTML page.

    Since you mentionned that you're asking participants to press the F11 key to make the task full screen, you may also be interested in the folowing piece of code (that you can insert in the same inline_javascript obbject as the above):

    // maximizes window automatically
    // Detects browser
    var browser = navigator.userAgent;
    if (browser.indexOf('Chrome') > -1) {
    vars.browser="Chrome/Edge"
    } else if (browser.indexOf('Safari') > -1) {
    vars.browser="Safari"
    } else if (browser.indexOf('Firefox') > -1) {
    vars.browser="Firefox"
    } else if (browser.indexOf('Opera') > -1) {
    vars.browser="Opera"
    } else if (browser.indexOf('MSIE') > -1) {
    vars.browser="Microsoft Internet Explorer"
    } else {
    vars.browser="Unknown browser"
    }
    
    // Detects if full screen mode is available
    if (document.fullscreenEnabled) {
    vars.fullscreen="Fullscreen mode is supported."
    } else {
    vars.fullscreen="Fullscreen mode is not supported."
    }
    
    function setFullScreen() {
    if (!document.fullscreenElement && // alternative standard method
    !document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement ) { // current working methods
    if (document.documentElement.requestFullscreen) {
    document.documentElement.requestFullscreen();
    } else if (document.documentElement.msRequestFullscreen) {
    document.documentElement.msRequestFullscreen();
    } else if (document.documentElement.mozRequestFullScreen) {
    document.documentElement.mozRequestFullScreen();
    } else if (document.documentElement.webkitRequestFullscreen) {
    document.documentElement.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
    }
    }
    }
    
    // if browser supports full screen mode,switch to it.
    if (document.fullscreenEnabled=true) {
    setFullScreen()
    }
    

    This code will set the task ton full screen automatically. It should work with most browsers. If you want to be absolutely certain, you can always display a message to participants asking them to press F11 is the task is not currently in full screen mode.

    Here's a comparison without and with the code described above:

    Note thata simpler way to automate the full screen presentation is to use OSWeb's "Make browser fullscreen" option:

    This will work for most tasks but in my experience, it generates problems with tasks using forms e.g., form_textinput); in such tasks, the forms can be unresponsive because browsers have security features that disable text input. So if you task does not use forms, this simple method should work. If it does, or if you notice that the task is unresponsive when made full screen using this method, use the code I insrted above.

    Here's my example so that you can't copy and paste the code and see exactly where it goes:

    Best,

    Fabrice.

    Buy Me A Coffee

  • Hi @Fab,

    My code works now. Thank you so much!

    I am basically a beginner at javascript, would you mind telling me where to learn these things about website settings that could work in OpenSaseme or OSWeb?

    Thanks again,

    Siyang.

  • Hi @Siyang,

    I'm no Javascript expert myself. I usually do basic searches in Google. the W3school website can be a good place to start (https://www.w3schools.com/js/).

    Best,

    Fabrice.

    Buy Me A Coffee

  • Hi @Fab ,

    Thank you for your reply!

    Best regards,

    Siyang

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu http://45.77.173.118/ Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games