Genie Discord forum

Author Avatarlyonsquark
12/5/2022, 3:45:44 PM

Hi - I want to have a button that @onclick determines a URL with code and then opens that URL in the browser.

I know how to do each separately ... I have one button that, when clicked, runs a handler that looks at elements on the web page (selections and text boxes), forms the URL and stores that in an @out builderlink bound variable.

Then I have another "Go" button that has :href="builderLink" target="_blank" .

This means that I have to press both of these buttons (in the right order).

I have a feeling that there's some Genie function I can run from the handler of the first button that can open the browser to that determined URL. I just don't know what that function is. Can someone let me know? Thanks!

By the way - this help-forum is really great! Thanks everyone in advance for answers.

Author Avatarlyonsquark
12/7/2022, 7:13:40 PM

I guess this is in fact not easy. The Stipple Lifecycle document at https://genieframework.com/docs/stipple/v0.25/guides/Stipple-LifeCycle.html says

we can send a JS payload to be executed on the frontend (so we can effectively inject and execute JS logic into the page from the Julia backend).

Can this happen in an @onchange or @onbutton handler?

Author Avatarlyonsquark
12/7/2022, 7:15:16 PM

If that worked, then I could call the window.open javascript command with the computed URL.