5

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 !

2 Answers2

3

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

0

You must config in Cargo.toml

tauri = { version = "x.y.z", features = [..., "shell-open"] }
xamgore
  • 1,723
  • 1
  • 15
  • 30
Ang Do
  • 1
  • 2