Q:

Is it possible in Blazor to open a URL in new tab programmatically?

0

This code will help you to understand how to open a URL in a new tab programmatically.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

We can make use of JS Interop to open a URL in new tab.

public async Task NavTo(string url, bool isNewTab)
{
       if (isNewTab)
        {
              await JSRuntime.InvokeAsync<object>("open", url, "_blank");
        }
        else
        {
                 NavManager.NavigateTo(url);
        }
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now