Open new Tab without JS

1 Answer 132 Views
General Discussions
Peter
Top achievements
Rank 1
Iron
Iron
Peter asked on 02 May 2022, 11:52 AM

Hello, 

is it possible open new tab in browser without Javascript?

without await JS.InvokeVoidAsync("open", $"www.telerik.com", "_blank");

If YES so HOW?

Peter

1 Answer, 1 is accepted

Sort by
0
Svetoslav Dimitrov
Telerik team
answered on 05 May 2022, 06:14 AM

Hello Peter,

Using JSInterop is the only programmatic way to open a web page in a new tab in Blazor. You can see this discussion in the public GitHub repository of ASP .NET Core where Steve Sanderson, the creator of Blazor, answered that JS Interop is the only way. 

Regards,
Svetoslav Dimitrov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Peter
Top achievements
Rank 1
Iron
Iron
commented on 06 May 2022, 11:18 AM

Hello Svetoslav,

You're right, but discussion was in 2019.

Do you know whether will it possible in future and when?

Marin Bratanov
Telerik team
commented on 07 May 2022, 03:40 PM

Hi Peter, I would recommend you address your query to Microsoft, as we are not the people developing the Blazor framework and choosing what JS wrappers to provide in it.

In the meantime, I'd suggest you create the needed JS method in your app, and the needed C# helper method to call it with, so that you can do this only in C# after the initial creation.

If you are using links to navigate you can already set their target attribute as desired too, so no need for any coding there.

Tags
General Discussions
Asked by
Peter
Top achievements
Rank 1
Iron
Iron
Answers by
Svetoslav Dimitrov
Telerik team
Share this question
or