Howdy, Stranger!

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

Supported by

[open] How to insert HTML link to a webpage?

edited October 2013 in OpenSesame


I'm using a Form Text Render to display a goodbye message at the end of an experiment. I want to insert an HTML link that, when clicked, opens the site with a web browser (i.e., I want to direct participants to a particular website after completing the experiment in OpenSesame). How do I go about doing this? Thanks very much!


  • edited October 2013

    Hyperlinks are not supported in OpenSesame. But you can approximate this functionality by adding a button to your form, and use an inline_script item to open a specific URL in an external browser when this button is clicked.

    For example, if you create a form_base with the following script, you will see two buttons:

    # Form_base script
    set rows "1;1"
    set cols "1"
    widget 0 0 1 1 button var="open_cogsci" text="Open"
    widget 1 0 1 1 button text="Do nothing"

    If you click the button labeled 'Open', the variable open_cogsci will be set to 'yes', and you can use this to launch a webbrowser in an inline_script placed after the form_base:

    # Inline_script
    import webbrowser
    if self.get('open_cogsci') == 'yes':'')

    Note that the resulting behavior may be a bit odd on some systems, because the OpenSesame window will loose focus, which is not what OpenSesame is designed for. But it might do the job for you.


    There's much bigger issues in the world, I know. But I first have to take care of the world I know.

  • edited 3:58PM

    I'll try it and see whether it works. Thanks Sebastiaan!

  • Dear all

    I would also like to add a link in OpenSesame which directs the participants to an online questionnaire (on Unipark). Is this still the only possibility to do so or is there an easier way by now?
    I would like to give the participants brief instructions and then ask them to click on the link in order for them to get redirected to the online questionnaire.

    Thanks in advance for your help!

  • Yes, this is still the only way. But it does what you want to do, right?

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.

  • Dear sebastiaan

    Sorry for my late answer! Yes, it does what I want it to do. I modified your version a bit. Instead of a form base I used a sketchpad and a response keyboard. I adopted your inline script and changed the answer:

    import webbrowser
    if self.get('open_cogsci') == 'space': #particpants have to press the spacebar to continue'')

    This works just fine (thanks for the code)! I have just one problem: when I run the experiment in the fullscreen mode and I press the spacebar, the experiment closes but the website opens "in the background" - meaning that the link doesn't pop up, instead the OpenSesame menu is visible (the link opens but I have to actively click on the webbrowser to see the link). Does this make sense?
    Is there a way to modify the code so the link pops up automatically (when I use the quickrun mode it works)?

    Thank you for your help!

  • Hi Erwin,

    The easiest workaround is probably to run the experiment in a window, but have the window cover the entire display so that it's effectively full screen. You can do this as follows:

    • Select the legacy backend, and click on Backend Settings in the General Properties tab.
    • Set Window position to 0,0.
    • Set Draw window frame to 'no'.
    • Set the resolution of the experiment to the resolution of the display.
    • Run the experiment in a window! (Which will now cover the entire screen.)

    I suspect that the browser should now automatically get the focus when you open a url, just like when you use quickrun.


    There's much bigger issues in the world, I know. But I first have to take care of the world I know.

  • Dear all,

    these comments on how to open a site with a web browser have been a great help.
    I have a follow up question: is there a possibility to close the browser again or an other way to return to open sesame?

    Thank you for your help!

Sign In or Register to comment.