gpt4 book ai didi

electron - 在 Electron 应用程序的页面之间导航

转载 作者:行者123 更新时间:2023-12-02 16:35:52 25 4
gpt4 key购买 nike

在 Electron 应用程序中,单击链接时导航到不同页面/位置的标准方法是什么?

我尝试创建

   <a href="/profile.html>profile</a>

和一个名为 profile.html 的 HTML 文件,但单击该链接只会将我的应用程序带到一个空白页面。

单击链接时实际发生了什么以及创建基本链接的正确方法是什么?

最佳答案

只需使用相对链接 - 这将起作用(注意开头没有斜杠):

<a href="profile.html">profile</a>

这是因为 Electron 使用映射到文件系统的本地 file:// URL。如果您链接到 /profile.html ,它将在驱动器根目录中查找该文件,并且您可能希望它从同一目录加载该文件。

此外,如果您将 profile.html 放在名为 Pages 的目录中,您可以像这样访问它:

<a href="pages/profile.html">profile</a>

关于electron - 在 Electron 应用程序的页面之间导航,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31765427/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com