Q:

Can Blazor open a URL in a new tab using UriHelper NavigateTo?

0

This code will help you to understand if Blazor opens a URL in a new tab using UriHelper NavigateTo or not.

All Answers

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

You have to use the JS interop to achieve this requirement.

public async Task NavigateToUrlAsync(string url, bool openInNewTab)
    {
        if (openInNewTab)
        {
            await JSRuntime.InvokeAsync<object>("open", url, "_blank");
        }
        else
        {
            this.UriHelper.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