大火导航经理到指定的URI(Google.com)

发布于 2025-02-04 19:25:05 字数 280 浏览 2 评论 0原文

我有一个问题,即如何将页面重定向到某些页面,例如

我尝试过的Google.com,但它无法正常工作...

@inject NavigationManager NavigationManager

void()
{
 NavigationManager.NavigateTo("google.com");
}

但是它与Ultimate URI转移到了链接。 像Localhost:3030/google.com,

我如何转到Google.com之类的页面?

i have a question about how to redirect page to certain page like google.com

I've tried with below but it's not working...

@inject NavigationManager NavigationManager

void()
{
 NavigationManager.NavigateTo("google.com");
}

but it moved to the link with ultimate uri.
like localhost:3030/google.com

how could i move to a page like google.com in Blazor?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

那小子欠揍 2025-02-11 19:25:05

void()没有有效的C#我认为我们可以猜测您正在尝试什么。

只是“ google.com”将被视为本地(相对)URI,这将无法使用。

使用:

//NavigationManager.NavigateTo("google.com");
  NavigationManager.NavigateTo("https://google.com");

While void() isn't valid C# I think we can guess what you are trying.

Just "google.com" will be seen as a local (relative) URI, that won't work.

Use:

//NavigationManager.NavigateTo("google.com");
  NavigationManager.NavigateTo("https://google.com");
赠意 2025-02-11 19:25:05

如果您想使用单击按钮访问Google页面,则可以这样做

<button onclick="window.location='http://google.com'">Google</button>

If you want to visit Google page with click of button, you can do it like this

<button onclick="window.location='http://google.com'">Google</button>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文