Welcome!

Sign in with your CogSci, Facebook, Google, or Twitter account.

Or register to create a new account.

We'll use your information only for signing in to this forum.

Supported by

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

esuahnilesuahnil Posts: 5
edited October 2013 in OpenSesame

Hi,

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!

Comments

  • sebastiaansebastiaan Posts: 2,516
    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 http://www.cogsci.nl"
    widget 1 0 1 1 button text="Do nothing"
    

    If you click the button labeled 'Open http://www.cogsci.nl/', 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':
        webbrowser.open('http://www.cogsci.nl/')
    

    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.

    Cheers!

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

  • esuahnilesuahnil Posts: 5
    edited 12:43AM

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

  • erwinwirneerwinwirne Posts: 2

    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!

  • sebastiaansebastiaan Posts: 2,516

    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.
    cogsci.nl/smathot

Sign In or Register to comment.