Remote.getCurrentWindow.loadUrl() vs window.location.href


Hey all,
I’m new to Electron, and I realized that there are two approaches to changing the url from the renderer process:
I can either delegate to the main process:


Or I can do it directly from the renderer process:

window.location.href = myUrl

Does anyone has an opinion about which is better to use? I’m not sure what the advantages of using each approach are.


The renderer process is easier to test and generally where you want to keep the majority of your application logic. The following topic may also contain points of interest.


Thanks, I found this discussion really helpful. It seems weird that you’d do stuff like file I/O from the renderer process, but it makes sense. I guess my thinking is still stuck in client-side development land


Agreed, use the chromium method.

Also, the remote module is synchronous and can cause UI lags. Generally it’s better to use async IPC instead of the remote module where possible.