I've got a Blazor WebApp and want to open a page (with several Telerik components) in a new tab. Unfortunately I can't use NavLink or NavigationManager.NavigateTo(url) as they won't open in a new tab/window.
After googling I realized the general consensus is to use javascript: await JS.InvokeVoidAsync("open", <url>, "_blank");
This works fine as long as the page url doesn't contain any parameters (url "/TestPage") but whenever I pass along a parameter (url "/TestPage/dummyParam") the page loads but the styling for the Telerik components are wrong (missing?)
As a sidenote, I get exactly the same weird behavior with a <a href="/TestPage/dummyParam" target="_blank"> so not an option.
Depending on what kind of Telerik components I've added to the opened page I get different errors.
A TelerikButton simply looks ugly but if I add a TelerikTextBox I get an exception "Error: Microsoft.JSInterop.JSException: Could not find 'TelerikBlazor.initTextBox' ('TelerikBlazor' was undefined)."
Were thinking maybe components were rendered too early so tried to show them only after OnAfterRender(), but still the same problems. Changing to prerender: false ( @rendermode="new
InteractiveServerRenderMode(prerender: false) ) didn't help at all but
I'm mostly grabbing at straws at this time..
I've made a very simple sample app demonstrating this problem, see zip.
1. Start page, all looks ok.
2. Pressing "open in new tab, no param" button, the TestPage is opened in new tab and everything looks fine, correct visuals etc.
3. Back to Home, press "open in new tab, one param" button, exactly the same TestPage is opened in a new tab but styles are now missing, layout is wrong and exceptions reported depending on what controls have been added.
4. Back to Home, pressing the href link, same behavior as nr 3.
Does the "open in new tab" break the SPA boundaries? The answer to my problem is probably obvious, but I just can't see it at the moment.