Skip to content

How can I go to another URL within my app #1438

Answered by vindevoy
vindevoy asked this question in Q&A
Discussion options

You must be logged in to vote

Solved my problem:

from shiny import App, ui
from starlette.applications import Starlette
from starlette.routing import Mount


def script_home():
    return ui.tags.script(
        """
        const button_nl = document.querySelector("#button_nl");
        const button_fr = document.querySelector("#button_fr");
        const button_en = document.querySelector("#button_en");

        button_nl.addEventListener("click", () => {
           window.location.href = "/nl/";
        });

        button_fr.addEventListener("click", () => {
           window.location.href = "/fr/";
        });

        button_en.addEventListener("click", () => {
           window.location.href = "/en/";
        })…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by vindevoy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant