I’m trying to open a link in a new tab from a Blazor Server application. I tried several methods such as
await JSRuntime.InvokeVoidAsync("open", action.ActionData, "_blank");
as well as
await JSRuntime.InvokeVoidAsync("NavigateTo", action.ActionData);
whereas the NavigateTo function appears as follows:
window.NavigateTo = (url) => {
const link = document.createElement('a');
link.href = url;
link.target="_blank";
document.body.appendChild(link);
link.click();
link.remove();
}
Everything is working fine in all browsers except for Safari on IOS.
Has anybody found a solution to this problem? As I found out, there is a problem opening a new tab in Safari from an asynchronous task. But I couldn’t find a way to start this synchronously from Blazor Server.




