4

Is there a way to do a hard browser refresh when running an app with nwjs, on Mac? nwjs's right click 'simulate browser restart' seems to start the app at its entrypoint again. Is there a way to simulate the behavior of simply clicking the shift reload button in Chrome?

ffConundrums
  • 765
  • 9
  • 24

2 Answers2

4

There is an nwjs api for this:

// Load native UI library
var ngui = require('nw.gui');
// Get the current window
var nwin = ngui.Window.get();
// this will do a hard refresh
nwin.reloadIgnoringCache();

// here's a regular refresh
 nwin.reload();

nwjs doc:

http://docs.nwjs.io/en/latest/References/Window/#winreloadignoringcache

ffConundrums
  • 765
  • 9
  • 24
1

just use javascript reload

location.reload();
004123
  • 270
  • 1
  • 12