It's giving following error!!
blazor.webassembly.js:1 Uncaught (in promise) TypeError: Converting circular structure to JSON
--> starting at object with constructor 'Window'
--- property 'window' closes the circle
at JSON.stringify (<anonymous>)
at blazor.webassembly.js:1
I was getting this error as well
change InvokeAsync<object> to InvokeVoidAsync and it seems to stop happening
strURL = "pages/mypage";
await JS.InvokeVoidAsync("open", strURL, "_blank");
Confirmed. I got the same error when using this. But it is interessting to see that the new tab is open and shows the correct page. But after successfully open the tab, the task is throwing an error due to the task has cancelled.
Edit: I tried to add an CancellationToken.Null as a parameter and it seems to work without exception.
await _js.InvokeAsync<object>("open", CancellationToken.None, url);
I am very new to this Blazor Server framework.
But I have been having the same 'JS Converting circular structure ' until I noticed that the two calls were slightly different:
await JSRuntime.InvokeAsync<object>("open", url, "_blank"); fails
await JSRuntime.InvokeVoidAsync("open", url, "_blank"); solves the problem.