.NET MAUI Blazor Hybrid how to intercept open in new tab

Andrew Denha 1 Reputation point
2022-06-07T09:11:19.863+00:00

I use await JSRuntime.InvokeAsync<object>("open", path, "_blank");
in the .razor pages, how I can intercept this and open:

  • new tab in browse
  • new page in the windows platform
  • same page in the android/ios platform

Or how I can create events from my Components(.razor pages) project
to the MAUI and Web projects

I`m try to use in my MainLayout.razor(RazorPages project):
[Parameter]
public EventCallback<string> OpenNewWindowByUrl { get; set; }

But I do not understand how to subscribe to this event from MainPage.xaml(MAUI project) BlazorWebView or _Layout.cshtml

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,066 questions
{count} votes