Electron app. Multiple html files

前端 未结 1 786
广开言路
广开言路 2021-01-03 03:17

I have an electron app with multiple html files in the root directory.

  • index.html
  • page1.html
  • page.html

I cannot find a way to

1条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-03 03:25

    When your first page is index.html you call that page, when you create your window.

    const win = new BrowserWindow(options);
    win.loadUrl(`file://${__dirname}/index.html`);
    

    If you want to load another page maybe

    win.loadUrl(`file://${__dirname}/page.html`);
    

    could help you.

    If the page should be loaded after a user action (e.g. click on a link). You can add the link to your index.hmtl page. Electron works here exactly like a browser.

    Go to page
    

    0 讨论(0)
提交回复
热议问题