Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
53
rated 0 times [  55] [ 2]  / answers: 1 / hits: 23240  / 9 Years ago, sun, november 8, 2015, 12:00:00

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 redirect from index.html to page1.html once Electro has started.



Does anyone know how to do this?


More From » node.js

 Answers
68

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.



<a href=page.html>Go to page</a>

[#64468] Thursday, November 5, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jailynbethanies

Total Points: 686
Total Questions: 119
Total Answers: 99

Location: Cook Islands
Member since Thu, May 21, 2020
4 Years ago
;