I am trying to open a new tab in Blazor Server. I am currently using JavaScript:
[Inject]
private IJSRuntime JSRuntime { get; set; } = null!;
JSRuntime.InvokeVoidAsync("open", PaymentWindowUrl, "_blank");
This does attempt to open the Url in a new tab, however it is blocked by the browser’s popup blocker and has to be allowed before it appears.
I would like to do this without the user having to click a button or link manually.
Seems to be OK in Edge but the popup issue occurs on Google Chrome.
Have tried to place an a href tag on the page and then do a .click() instead with JavaScript but the issue still occurs.
Is there anyway I can bypass this? I am unable to find much on the internet. Or do I have to bite the bullet and let the user allow the popup?