Electron - renderer.js across html pages

Viewed 41

Good evening.

I am experimenting with electron and I really like it. However, I’m becoming stuck on some fundamentals that seem to slip between the net in terms of documentation. It’s definitely an understanding thing on my part, so I thought I’d ask the good people for some guidance.

I have an electron app with a main.js that loads in index.html.

In index.html I have some markup and also a script tag linking to renderer.js at the bottom of the page.

Everything works great with the ipc allowing main.js and renderer.js to communicate, so I am able to do client side js and also use node functionality on index.html, as node integration is set to true.

I also have another page (about.html). This also has renderer.js in a script tag at the bottom of the page. However, when I click a button in the electron app and land on about.html, the renderer.js script does nothing at all when any functions are called, and logs nothing to the console.

In fact, renderer.js only seems to work on index.html in electron.

Why is this?

Thanks in advance.

0 Answers
Related