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

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

  • 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!

  • edited 10:31PM

    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?

  • 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
        webbrowser.open('http://www.cogsci.nl/')

    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!
    Erwin

  • 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.

    Cheers,
    Sebastiaan

  • 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!
    Stephanie

  • Hi,

    I would also like to redirect participants to an online questionnaire, on Framaforms. Using the script you provided, I didn't manage to make it work in OSWeb (my experiments are online).

    Any suggestion?

    Thomas

  • Hi @ChartTom ,

    You can use window.open() in an inline_javascript item to open a website in a new browser tab. If your online questionnaire has a URL, then this might work. Important: This is for OSWeb experiments! The discussion above refers to lab experiments, which require a very different solution!)

    window.open('https://osdoc.cogsci.nl')
    

    Cheers,

    Sebastiaan

  • Hi @sebastiaan

    I have a follow-up question on this issue. I am doing an experiment online with OSWeb and used the solution you proposed to insert a link. My problem is that the link opens immediately when I start the experiment, is there any way that I can avoid this?


    Thanks in advance,

    Anna

  • Hi @atporrini ,

    You probably inserted this code into the Prepare phase of the script. If you insert it into the Run phase, it will get executed when you expect it to. See also:

    — Sebastiaan

  • Thanks for post!

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