Electron: How to do force reload?

Viewed 4450

The default Menu of Electron has two types of reloading or refreshing window

  • Reload (Ctrl + R)
  • Force Reload (Ctrl + Shift + R)

I created a custom menu, and create the same functionality as the first one.

label: 'Reload Window',
  accelerator: "CmdOrCtrl+R", 
  click: () => {
     mainWindow.reload();
}}

the code to reload the window is simply mainWindow.reload();, but how about the Force Reload? I tried adding some CSS and JS then try my newly created reload Menu but it just refreshes the window, CSS and JS don't make any changes.

1 Answers

You should be able to use reloadIgnoringCache on the webContents

So something like mainWindow.webContents.reloadIgnoringCache()

Related