首页 > 解决方案 > 在 Mac 上使用 nwjs 硬刷新浏览器

问题描述

在 Mac 上运行带有 nwjs 的应用程序时,有没有办法进行硬浏览器刷新?nwjs 的右键单击“模拟浏览器重启”似乎再次在其入口点启动应用程序。有没有办法模拟在 Chrome 中单击 shift reload 按钮的行为?

标签: nwjs

解决方案


为此有一个 nwjs api:

// 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 文档:

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


推荐阅读