Tauri : How to open webpage when cliking on the menu

Viewed 871

I'm trying to make a small tauri app with the same menu on the top of each page. I followed this tutorial, "Adding the menu to all windows" section. I can see the menu, I can quit the app with it, but I can't find out how to go to another hmtl page when cliked.

I've got this piece of code but I have no idea what to put under "accel"

.on_menu_event(|event| {
      match event.menu_item_id() {
        "quit" => {
          std::process::exit(0);
        }
        "close" => {
          event.window().close().unwrap();
          
        }
        "accel" => {
          //not working, as you can imagine
          //tauri::WindowUrl::App("index.html".into());
          //I would like tauri to display index.html in the main window
        }
        _ => {}
      }
    })

Does someone has an idea on how to do that ? I've found dozen of example code with menus but none showed what I'm looking for (or I'm unable to point out the line I need)

Thanks for your help !

1 Answers

I finally got the answer from the tauri discord chat, I hope it can be useful to someone?

window.eval("window.location.replace('your.url')"); made the job

Related